#include using namespace std; typedef signed long long ll; #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 FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) template bool chmax(T &a, const T &b) { if(a bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int Q; const int prime_max = 1000000; vector prime; int NP,divp[prime_max]; 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; if(v%2==0) return false; 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; } void solve() { int i,j,k,l,r,x,y; string s; cprime(); cin>>Q; while(Q--) { ll N; cin>>N; int ok=1; FORR(p,prime) { if(1LL*p*p*p>N) { ok=0; break; } if(N%p) continue; N/=p; FORR(q,prime) { if(1LL*q*q>N) { ok=0; } break; if(N%q) continue; N/=q; if(MillerRabin(N,20)==0) ok=0; } break; } if(ok) { cout<<"Yes"<