#include<bits/stdc++.h>
using namespace std;
bool ktra(int64_t a)
{
    bool kt=true;
    if (a<2)
    {
        return false;
    }
    else
    {
        for(int64_t i=2;i*i<=a;i++)
        {
            if(a%i==0)
            {
                kt=false;
                break;
            }
        }
        return kt;
    }
}
int main()
{
    ifstream fi("cprime.inp");
    ofstream fo("cprime.out");
    int64_t n;
    fi>>n;
    for(int64_t i=1;i<=n;i++)
    {
        int64_t a;
        fi>>a;
        if(ktra(a))
        {
            fo<<"YES"<<'\n';
        }
        else
        {
            fo<<"NO"<<'\n';
        }
    }
}
