#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int Q; ll N; const int prime_max = 1000000; int NP,prime[100000],divp[prime_max]; map M; void cprime() { if(NP) return; for(int i=2;i=i&&j>=1; return r; } bool MillerRabin(ll v,int loop=10) { ll d=v-1; int s=0,i,j; if(v<=1) return false; if(v==2) return true; while(d%2==0) d/=2,s++; FOR(i,loop) { ll a=abs(rand()*rand()+rand())%(v-2)+1; ll r=modpow(a,d,v); if(r==1 || r==v-1) continue; FOR(j,s) { r=modpow(r,2,v); if(r==v-1) break; } if(j==s) return false; } return true; } bool issq(ll v) { for(ll a=sqrt(v)-10;a<=sqrt(v)+10;a++) { if(a*a==v && MillerRabin(a)) return 1; } return 0; } set S,T; void solve() { int i,j,k,l,r,x,y; string s; srand(time(NULL)); cprime(); FOR(i,NP) { ll a=1; while(a*prime[i]/prime[i]==a) { a*=prime[i]; if(a>1000000000000000000LL) break; S.insert(a); if(i==0) T.insert(a); } } cin>>Q; while(Q--) { cin>>N; int ok=0; if(N<=100) { FORR(c,S) { if(ok) break; ll left=N-c; if(left<2) break; if(S.count(left)) ok=1; } } else if(N%2==0) { ok=1; } else { FORR(c,T) { if(ok) break; ll left=N-c; if(left<2) break; if(S.count(left)) ok=1; if(left>1000000 && MillerRabin(left)) ok=1; if(left>1000000000000LL && issq(left)) ok=1; } } if(ok) cout<<"Yes"<