#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll power(ll a, ll d,ll n)
{
ll ans=1;
while(d>0)
{
a=a%n;
if(d&1)
{
ans=(ansa)%n;
}
a=(aa)%n;
d>>1;
}
ans=ans%n;
return ans;
}
int solve(ll d,ll n)
{
ll a= 2+ rand()%(n-4);
ll x=power(a,d,n);
int i=0,j=1;
int t=0;
if(x==1)
{
return i;
}
if(x==n-1)
{
return j;
}
//int t;
else
{
while(d!=n-1)
{
x=(xx)%n;
d=2;
if(x==1)
{
t=i;
break;
}
if(x==n-1)
{
t=j;
break;
}
}
return t;
}
}
int main()
{
int n;
cin>>n;
while(nβ)
{
long long int m;
cin>>m;
if(m==1||((m%2==0)&&(m!=2)))
{
cout<<βNOβ<<endl;
}
else if(m==2||m==3)
{
cout<<βYESβ<<endl;
}
else
{
ll d=m-1;
while(d%2!=0)
{
d=d/2;
}
int q=solve(d,m);
if(q==1)
{
cout<<βYESβ<<endl;
}
else
{
cout<<βNOβ<<endl;
}
}
}
return 0;
}