#include using namespace std; const vector dx = {0, 0, 1, -1}; const vector dy = {1, -1, 0, 0}; #define vec vector #define int long long #define double long double //cout< #define pq priority_queue #define all(V) begin(V),end(V) #define printpair(p) cout< template inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; } #define nexper(Z) next_permutation(all(Z)) #define pb push_back signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; vec E(100001,true); vec Z; E[1]=E[0]=false; for(int i=2;i<=100000;i++){ if(!E[i]){continue;} Z.push_back(i); for(int j=i+i;j<=100000;j+=i){ E[j]=false; } } rep(i,n){ int k;cin>>k; int cnt=0; for(int z:Z){ while(k%z==0){k/=z;cnt++;} } if(k!=1){cnt++;} if(cnt==3){cout<<"Yes\n";} else{cout<<"No\n";} } }