#include #include using namespace std; typedef long long LL; const int ps[]={2,3,5,7,11,13,17,19,23,29,31,37}; const int pcnt=sizeof(ps)/sizeof(int); inline LL mt(LL a,LL b,LL m) { LL d=((long double)a/m*b+1e-8); LL r=a*b-d*m; return r<0?r+m:r; } inline LL mpow(LL a,LL b,LL m) { LL res=1; for(;b;b>>=1,a=mt(a,a,m)) if(b&1) res=mt(res,a,m); return res; } inline LL gcd(LL a,LL b) { if(!a||!b) return a+b; int t=__builtin_ctzll(a|b); a>>=__builtin_ctzll(a); do { b>>=__builtin_ctzll(b); if(a>b) { LL t=b; b=a; a=t; } b-=a; } while(b!=0); return a<>=1,++k; for(int i=0;i1) break; } } if(t>1||(t=gcd(q,n))>1) break; } if(t==n) for(t=1;t==n;t=gcd(abs((x=nxt(x,n,a))-y),n)); return t; } void solve(LL n) { if(n==1) return; if(isp(n)) { f[cnt++]=n; return; } LL t=n; while(t==n) t=rho(n); solve(t); solve(n/t); } int main() { int T; LL n; scanf("%d",&T); while(T-->0) { scanf("%lld",&n); cnt=0; solve(n); sort(f,f+cnt); if(cnt==1) puts("Prime"); else printf("%lld\n",f[cnt-1]); } return 0; }