//THIS IS MY SOLUTION
include<bits/stdc++.h>
using namespace std;
bool prime(long long int a) { bool c= true; for(int i = 2;i<=sqrt(a);i++) { if(a%i == 0) { c = false; break; } } if(c == true ) return true; else return false;
}
bool T_PRIME(long long int a) { float test = sqrt(a) ; int test1 = floor(sqrt(a));
if(test - test1 == 0)
{
if(prime(sqrt(a)) == true)
return true;
else
return false;
}
else
return false;
}
int main() { int t; cin>>t; vector a; for(int i = 0;i<t;i++) { int k; cin>>k; a.push_back(k);
}
for(auto i : a)
{
if(T_PRIME(i) == true)
cout<<"YES"<<"\n";
else
cout<<"NO"<<"\n";
}
}