#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        long y = (long)(sqrt(x) + 0.5);
        if (y*y == x) {
            double z = sqrt(y);
            for (int i = 2; i < z; i++) {
                if (y % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        long long y = static_cast<int>(sqrt(x));
        if (sqrt(x) == y) {
            for (int i = 2; i < sqrt(y); i++) {
                if (y % i == 0) {
                    cout << "NO\n";
                    continue;
                }
            }
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        auto y = (long)(sqrt(x) + 0.5);
        if (y*y == x) {
            double z = sqrt(y);
            for (int i = 2; i < z; i++) {
                if (y % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        auto y = (long long)(sqrt(x) + 0.5);
        if (y*y == x) {
            for (int i = 2; i < y; i++) {
                if (y % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        long long y = floor(sqrt(x)+0.5);
        if (y*y == x) {
            for (int i = 2; i < y; i++) {
                if (x % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        double y = sqrt(sqrt(x));
        if (floor(y) == y) {
            long z = (long) y;
            for (int i = 2; i < y; i++) {
                if (z % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        long long y = static_cast<int>(sqrt(x));
        if (sqrt(x) == y) {
            for (int i = 2; i < sqrt(y); i++) {
                if (y % i == 0) {
                    cout << "NO\n";
                }
            }
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        long long y = (long long) (sqrt(x));
        if (y*y == x) {
            for (int i = 2; i < y; i++) {
                if (x % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        long long y = (long long) (sqrt(x)+0.5);
        if (y*y == x) {
            for (int i = 2; i < y; i++) {
                if ((x/i)*i == x) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

/*void test() {
    int64_t t,x;
    cin>>x;

    int s=sqrt(x)+0.5;
    cout<<(isPrime(s) ? "Yes\n" : )
}*/
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        long long y =  round(sqrt(x));
        if (x == 1) {
            cout<<"NO\n";
            continue;
        }
        if (y*y == x) {
            for (long long i = 2; i < sqrt(y)+1; i++) {
                if ((x/i)*i == x) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    long long x;
    bool a;
    cin >> n;
    for(int j=0;j<n;j++) {
        cin>>x;
        a=true;
        long long y = (long long)(sqrt(x) + 0.5);
        if (y*y == x) {
            for (int i = 2; i < y; i++) {
                if (x % i == 0) {
                    cout << "NO\n";
                    a=false;
                    break;
                }
            }
            if(a) {
                cout << "YES\n";
            }
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}


#include <iostream>
#include <string>
using namespace std;
bool t_prime(unsigned long long n) {
	unsigned long long count= 0;
	for (unsigned long long i = 2; i <= n / 2; i++) {
		if (n%i == 0) { count++; continue; }
	}
	if (count == 1) { return true; }
	else return false;
}
int main()
{
	unsigned long test;
	cin >> test;
	for (unsigned long i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		bool result = t_prime(n);
		if (result == true) cout << "YES" << endl;
		else if (result == false) cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {
	if (n == 2) return true;
	else if ((n % 2 == 0)&&(n!=2)) { return false; }
	else if(n%2!=0) {
		for (unsigned long long i = 3; i*i <= n; i += 2) {
			if (n%i == 0) { return false; }
		}
		return true;
	}
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) { cout << "NO" << endl; }
			else if (s*s==n) {
				bool result = is_prime(sqrt(n));
				if (result == true) cout << "YES" << endl;
				else if (result == false) cout << "NO" << endl;
			}

	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {

	for (unsigned long long i = 2; i <= n / 2; i++) {
		if (n%i == 0) { return false; }
	}
    return true;
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		if ((sqrt(n)*sqrt(n)) == n) {
			bool result = is_prime(sqrt(n));
			if (result == true) cout << "YES" << endl;
			else if (result == false) cout << "NO" << endl;
		}
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;

long calc(long arr[]) {
	 int index = 1;
	 arr[0] = 2;
	for (long i = 3; i < 1000; i+=2) {
		int flag = 0;
		for (long j = 2; j <= sqrt(i); j++) {

			if (i%j == 0) { flag = 1; break; }
			else continue;
		}
		if (flag==0) arr[index++] = i;
	}

	return index;

}
bool is_prime(unsigned long long n,long index,long arr[]) {

	for (long i = 0; i < index; i++) {
		if (n == arr[i]) { return true; }
	}
	return false;
}
int main()
{
	long primes[1000];
	long index=calc(primes);
	/*
	for (int i = 0; i < index; i++) {
		cout << primes[i] << endl;
	}
	*/

	unsigned long test;
	cin >> test;
	for (unsigned long i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) {
			cout << "NO" << endl;
		}
			else {

				if (is_prime(s,index,primes)) cout << "YES" << endl;
				else  cout << "NO" << endl;
			}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {

	for (unsigned long long i = 2; i <= n / 2; i++) {
		if (n%i == 0) { return false; }
	}
    return false;
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		bool result = is_prime(sqrt(n));
		if (result == true) cout << "YES" << endl;
		else if (result == false) cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {

	for (unsigned long long i = 2; i <= n / 2; i++) {
		if (n%i == 0) { return false; }
	}
    return true;
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) { cout << "NO" << endl; }
			else if (s*s==n) {
				bool result = is_prime(sqrt(n));
				if (result == true) cout << "YES" << endl;
				else if (result == false) cout << "NO" << endl;
			}

	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;

long calc(long arr[]) {
	 int index = 1;
	 arr[0] = 2;
	for (long i = 2; i < 1000; i++) {
		int flag = 0;
		for (long j = 3; j <= sqrt(i); j+=2) {

			if (i%j == 0) { flag = 1; break; }
			else continue;
		}
		if (flag==0) arr[index++] = i;
	}

	return index;

}
bool is_prime(unsigned long long n,long index,long arr[]) {

	for (long i = 0; i < index; i++) {
		if (n == arr[i]) { return true; }
	}
	return false;
}
int main()
{
	long primes[1000];
	long index=calc(primes);

	unsigned long test;
	cin >> test;
	for (unsigned long i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) {
			cout << "NO" << endl;
		}
			else {

				if (is_prime(s,index,primes)) cout << "YES" << endl;
				else  cout << "NO" << endl;
			}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {
	if(n==2) return true;
	else {
	for (unsigned long long i = 3; i*i <= n; i+=2) {
		if (n%i == 0) { return false; }
	}
    return true;
	}
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) { cout << "NO" << endl; }
			else if (s*s==n) {
				bool result = is_prime(sqrt(n));
				if (result == true) cout << "YES" << endl;
				else if (result == false) cout << "NO" << endl;
			}

	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;

long calc(long arr[]) {
	 int index = 0;
	for (long i = 2; i < 1000; i++) {
		int flag = 0;
		for (long j = 2; j <= sqrt(i); j++) {

			if (i%j == 0) { flag = 1; break; }
			else continue;
		}
		if (flag==0) arr[index++] = i;
	}

	return index;

}
bool is_prime(unsigned long long n,long index,long arr[]) {

	for (long i = 0; i < index; i++) {
		if (n == arr[i]) { return true; }
	}
	return false;
}
int main()
{
	long primes[1000];
	long index=calc(primes);

	unsigned long test;
	cin >> test;
	for (unsigned long i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) {
			cout << "NO" << endl;
		}
			else {

				if (is_prime(s,index,primes)) cout << "YES" << endl;
				else  cout << "NO" << endl;
			}
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {

	for (unsigned long long i = 2; i*i <= n; i++) {
		if (n%i == 0) { return false; }
	}
    return true;
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		unsigned long long s = sqrt(n);
		if ((n == 1) || (s*s != n)) { cout << "NO" << endl; }
			else if (s*s==n) {
				bool result = is_prime(sqrt(n));
				if (result == true) cout << "YES" << endl;
				else if (result == false) cout << "NO" << endl;
			}

	}

	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool is_prime(unsigned long long n) {

	for (unsigned long long i = 2; i <= n / 2; i++) {
		if (n%i == 0) { return false; }
	}
    return true;
}
int main()
{
	unsigned long test;
	cin >> test;
	for (int i = 0; i < test; i++) {
		unsigned long long n;
		cin >> n;
		if (is_prime(n) == true) { cout << "NO" << endl; }

		else if (is_prime(n) == false) {

			if ((sqrt(n)*sqrt(n)) == n) {
				bool result = is_prime(sqrt(n));
				if (result == true) cout << "YES" << endl;
				else if (result == false) cout << "NO" << endl;
			}
			else cout << "NO" << endl;
		}
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/
	vector<bool> primes(1e6+15, 1);

	primes[0] = primes[1] = 0;
	for (register int i = 2; i <= 1e6+14; i++)
	{
		if (primes[i])
			for (register int j = i + i; j <=1e6+14 ; j += i)
				primes[j] = 0;
	}

	sc(n);
	lop(i, n)
	{
		scanf("%I64d", &x);

		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		if (primes[x])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/

	sc(n);
	lop(i, n)
	{
		//scanf("%I64d",&x);
		cin >> x;
		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		for(ll j=2;j*j<=x;j++)
			if (x % j == 0)
			{
				cout << "NO" << endl;
				break;
			}

		cout << "YES" << endl;
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/

	sc(n);
	lop(i, n)
	{
		//scanf("%I64d",&x);
		cin >> x;
		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		bool f = 0;
		for(ll j=2;j*j<=x;j++)
			if (x % j == 0)
			{
				cout << "NO" << endl;
				f = 1;
				break;
			}
		if(!f)
		cout << "YES" << endl;
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/
	vector<bool> primes(1e6+15, 1);

	primes[0] = primes[1] = 0;
	for (int i = 2; i <= 1e6+14; i++)
	{
		if (primes[i])
			for (int j = i + i; j <=1e6+14 ; j += i)
				primes[j] = 0;
	}

	sc(n);
	lop(i, n)
	{
		scanf("%I64d", &x);

		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		if (primes[x])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/
	vector<bool> primes(1e6+15, 1);

	primes[0] = primes[1] = 0;
	for (int i = 2; i <= 1e6+14; i++)
	{
		if (primes[i])
			for (int j = i + i; j <=1e6+14 ; j += i)
				primes[j] = 0;
	}

	sc(n);
	lop(i, n)
	{
		//scanf("%I64d",&x);
		cin >> x;
		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		if (primes[x])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/
	vector<bool> primes(1e3+15, 1);

	primes[0] = primes[1] = 0;
	for (int i = 2; i <= 1e3+14; i++)
	{
		if (primes[i])
			for (int j = i + i; j <= n; j += i)
				primes[j] = 0;
	}

	sc(n);
	lop(i, n)
	{
		//scanf("%I64d",&x);
		cin >> x;
		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		if (primes[x])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}


#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#pragma warning(disable : 4996)

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define scl(x)              scanf("%lld",&x)
#define lop(i,n)        for(int i=0;i<n;i++)
#define loop(i,f,l)     for(int i=f;i<l;i++)
#define R_(s)         freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W R_("input.txt"),W_("output.txt")
#define PI                        acos(-1.0)
#define INF                       1000000000
#define DFS_GRAY  -1
#define DFS_WHITE  0
#define DFS_BLACK  1

#define scc(x)           scanf("%c",&x)
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
typedef unsigned int uint;
typedef long long ll;

typedef string            ss;
typedef long long         ll;
typedef pair <int, int>   ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

//-----------------------------------------------------
const int N = 1e5+15;
const ll MOD = 1e9 + 7;

int dX[] = { 0,0,1,-1 };
int dY[] = { 1,-1,0,0 };

ll GCD(ll num, ll ones) { return !ones ? num : GCD(ones, num % ones); }
ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
double Len(int x, int y, int X, int Y) { return sqrt((X - x) * (X - x) + (Y - y) * (Y - y)); }
ll fastP(ll b, ll p)
{
	if (p == 0) return 1;
	else if (p == 1) return b;
	ll a = fastP(b, p / 2) % MOD;
	if (p % 2) return (((a * a) % MOD) * b) % MOD;
	else return (a * a) % MOD;
}
//----------------- ------   -------
ll x;
int n;

int main()
{
	/*
	#ifndef ONLINE_JUDGE
		freopen("i.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/
	vector<bool> primes(1e3+15, 1);

	primes[0] = primes[1] = 0;
	for (int i = 2; i <= 1e3+14; i++)
	{
		if (primes[i])
			for (int j = i + i; j <=1e3+14 ; j += i)
				primes[j] = 0;
	}

	sc(n);
	lop(i, n)
	{
		//scanf("%I64d",&x);
		cin >> x;
		long double temp = x;
		temp = sqrt(temp);
		if(temp!=floor(temp)||x==1)
		{
			cout << "NO" << endl;
			continue;
		}
		x = temp;
		if (primes[x])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(int n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(int i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	int n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt(a), 2) == a && is_prime(sqrt(a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(int n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(int i = 3; i * i < n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	int n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (pow(sqrt(a), 2) == a) {
			if (is_prime(sqrt(a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(long long n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(long long i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	long long n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt((int)a), 2) == a && is_prime(sqrt(a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(long long n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(long long i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	long long n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow((long long)sqrt(a), 2) == (long long)a && is_prime(sqrt(a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(long long n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(long long i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	long long n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt((long long)a), 2) == a && is_prime(sqrt((long long)a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(long long n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(long long i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	long long n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt((long long)a), 2) == (long long)a && is_prime(sqrt((long long)a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(long long n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(long long i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	long long n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt((int)a), 2) == a && is_prime(sqrt((int)a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(int n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(int i = 3; i * i < n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	int n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt(a), 2) == a) {
						if (is_prime(sqrt(a))) {
							cout << "YES" << endl;
						} else {
							cout << "NO" << endl;
						}
					} else {
						cout << "NO" << endl;
					}
		}

	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(long long n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(long long i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	long long n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt(a), 2) == a && is_prime(sqrt(a))) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

bool is_prime(int n) {
	if (n == 2) {
		return true;
	} if (n % 2 == 0) {
		return false;
	} else {
		for(int i = 3; i * i <= n; i+=2) {
			if (n % i == 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {

	int n, a;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			cout << "NO" << endl;
		} else {
			if (pow(sqrt(a), 2) == a && is_prime(sqrt(a))) {

			}
		}
	}

	return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <array>
#include <string>
#include <queue>
#include <iterator>

using namespace std;

int main()
{
    int n;
    cin >> n;

    int lim = 1e6 + 2;
    vector<bool> s(lim, true);
    s[0] = 0;
    s[1] = 0;

    int curr = 2;
    while (curr < lim && s[curr])
    {
        long long i = curr * curr;
        while (i < (long long)lim)
        {
            s[i] = 0;
            i += curr;
        }

        ++curr;
    }

    unordered_map<long long, bool> primes;

    for (int i = 0; i<s.size(); ++i)
        if (s[i])
        {
            long long tprime = i * i;
            primes[tprime] = 1;
        }

    while (n--)
    {
        long long x;
        cin >> x;

        if (primes.find(x) != primes.end())
            cout << "YES\n";
        else
            cout << "NO\n";
    }
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <array>
#include <string>
#include <queue>
#include <iterator>

using namespace std;

int main()
{
    long long n;
    cin >> n;

    long long lim = 1e6 + 5;
    vector<bool> s(lim, true);
    s[0] = 0;
    s[1] = 0;

    long long curr = 2;
    while (curr < lim)
    {
        if (s[curr])
        {
            long long kyu2 = curr;
            long long i = kyu2 * kyu2;
            while (i < lim)
            {
                s[i] = 0;
                i += curr;
            }
        }

        ++curr;
    }

    unordered_map<long long, bool> primes;

    for (long long i = 0; i < s.size(); ++i)
        if (s[i])
        {
            long long kyu = i;
            long long tprime = kyu * kyu;
            primes[tprime] = 1;
        }

    while (n--)
    {
        long long x;
        cin >> x;

        if (primes.find(x) != primes.end())
            cout << "YES\n";
        else
            cout << "NO\n";
    }
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <array>
#include <string>
#include <queue>
#include <iterator>

using namespace std;

int main()
{
    int n;
    cin >> n;

    while (n--)
    {
        long long x;
        cin >> x;

        int lim = ((int)sqrt(x)) + 2;
        vector<bool> s(lim, true);
        s[0] = 0;
        s[1] = 0;

        int curr = 2;
        while (curr < lim && s[curr])
        {
            long long i = curr * curr;
            while (i < (long long)lim)
            {
                s[i] = 0;
                i += curr;
            }

            ++curr;
        }

        unordered_map<long long, bool> primes;

        for (int i = 2; i < lim; ++i)
            if (s[i])
            {
                long long tprime = i * i;
                primes[tprime] = 1;
            }

        if (primes.find(x) != primes.end())
            cout << "YES\n";
        else
            cout << "NO\n";
    }
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <array>
#include <string>
#include <queue>
#include <iterator>

using namespace std;

int main()
{
    int n;
    cin >> n;

    int lim = 1e6 + 2;
    vector<bool> s(lim, true);
    s[0] = 0;
    s[1] = 0;

    int curr = 2;
    while (curr < lim && s[curr])
    {
        long long i = curr * curr;
        while (i < (long long)lim)
        {
            s[i] = 0;
            i += curr;
        }

        ++curr;
    }

    unordered_map<long long, bool> primes;

    for (int i = 0; i<s.size(); ++i)
        if (s[i])
        {
            long long kyu = i;
            long long tprime = kyu * kyu;
            primes[tprime] = 1;
        }

    while (n--)
    {
        long long x;
        cin >> x;

        if (primes.find(x) != primes.end())
            cout << "YES\n";
        else
            cout << "NO\n";
    }
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <array>
#include <string>
#include <queue>
#include <iterator>

using namespace std;

int main()
{
    long long n;
    cin >> n;

    long long lim = 1e6 + 2;
    vector<bool> s(lim, true);
    s[0] = 0;
    s[1] = 0;

    long long curr = 2;
    while (curr < lim && s[curr])
    {
        long long kyu2 = curr;
        long long i = kyu2 * kyu2;
        while (i < lim)
        {
            s[i] = 0;
            i += curr;
        }

        ++curr;
    }

    unordered_map<long long, bool> primes;

    for (long long i = 0; i<s.size(); ++i)
        if (s[i])
        {
            long long kyu = i;
            long long tprime = kyu * kyu;
            primes[tprime] = 1;
        }

    while (n--)
    {
        long long x;
        cin >> x;

        if (primes.find(x) != primes.end())
            cout << "YES\n";
        else
            cout << "NO\n";
    }
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define TC(tc) while (tc--)
#define VI vector<int>
#define PII pair<int, int>
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

bool isPrime(int& sqr)
{
	if (sqr == 1) return 0;
	for (int i = 2; i * i <= sqr; i++)
	{
		if (sqr % i == 0)
		{
			return 0;
		}
	}
	return 1;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tc; cin >> tc;
	TC(tc)
	{
		ull n; cin >> n;
		double sqr = sqrt(n);
		if (sqr == int(sqr))
		{
			int k = sqr;
			if (isPrime(k))
			{
				cout << "YES\n";
			}
			else
			{
				cout << "NO\n";
			}
		}
		else
		{
			cout << "NO\n";
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define TC(tc) while (tc--)
#define VI vector<int>
#define PII pair<int, int>
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

int main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tc; cin >> tc;
	TC(tc)
	{
		int n; cin >> n;
		double sqr = sqrt(n);
		if (sqr == int(sqr))
		{
			double sqr1 = sqrt(sqr);
			if (sqr1 != int(sqr1))
			{
				cout << "YES\n";
			}
			else
			{
				cout << "NO\n";
			}
		}
		else
		{
			cout << "NO\n";
		}
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define TC(tc) while (tc--)
#define VI vector<int>
#define PII pair<int, int>
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

bool isPrime(int& sqr)
{
	if (sqr == 1) return 0;
	for (int i = 2; i * i <= sqr; i++)
	{
		if (sqr % i == 0)
		{
			return 0;
		}
	}
	return 1;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tc; cin >> tc;
	TC(tc)
	{
		int n; cin >> n;
		double sqr = sqrt(n);
		if (sqr == int(sqr))
		{
			int n = sqr;
			if (isPrime(n))
			{
				cout << "YES\n";
			}
			else
			{
				cout << "NO\n";
			}
		}
		else
		{
			cout << "NO\n";
		}
	}

	return 0;
}


#include<stdio.h>
#include<math.h>
bool primes(long long n)
{
	long long temp = sqrt(n);
	if (temp * temp == n)
	{
		if (temp < 2)
			return false;
		else
		{
			for (long long i = 2;i <= sqrt(temp);i++)
			{
				if (temp % i == 0)
					return false;
			}
			return true;
		}
	}
	else return false;
}
int main()
{
	int n;
	long long x;
	scanf("%d", &n);
	for (int i = 0;i < n;i++)
	{
		scanf("%lld", &x);
		if (primes(x)) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long n, x, v = 0;
	scanf("%lld", &n);
	for (int p = 0;p < n;p++)
	{
		scanf("%lld", &x);
		for (int i = 1;i < x;i++)
		{
			if (x % i == 0)
				v += 1;
			if (v > 2) break;
		}
		if (v == 2) printf("YES\n");
		else printf("NO\n");
		v = 0;
		fflush(stdin);
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long n, x, v = 0;
	scanf("%lld", &n);
	for (int p = 0;p < n;p++)
	{
		scanf("%lld", &x);
		for (int i = 1;i <= x;i++)
		{
			if (x % i == 0)
				v += 1;
			if (v > 3) break;
		}
		if (v == 3) printf("YES\n");
		else printf("NO\n");
		v = 0;
	}
	return 0;
}


#include<iostream>
using namespace std;
int binarysearch(long long arr[], int l, int r, long long x)
{

    if (l > r)
        return -1;
    int mid = (l + r) / 2;
    if (arr[mid] == x)
        return mid;
    if (arr[mid] < x)
    {
        return binarysearch(arr, mid + 1, r, x);
    }
    if (arr[mid] > x)
    {
        return binarysearch(arr, l, mid - 1, x);
    }
    return -1;
}
int main()
{
    int k = 1000000;
    bool* prime = new bool[k + 1];
    for (int i = 0; i <= 1000000; i++)
        prime[i] = true;

    for (int p = 2; p <= k; p++)
    {
        if (prime[p] == true)
        {
            for (int i = 2; i * p <= k; i++)
                prime[i * p] = false;
        }
    }
    int index = 0;
    long long square[78498];
    for (int p = 2; p <= k; p++)
    {
        if (prime[p])
        {
            square[index] = (long long)p * (long long)p;
            index += 1;
        }
    }
    int t;
    cin >> t;
    long long* arr = new long long[t];
    {
        for (int i = 0; i < t; i++)
        {
            cin >> arr[i];
            int z = binarysearch(square, 0, 78497, arr[i]);
            if (z == -1)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
    }
}


#include<iostream>
using namespace std;
int binarysearch(int arr[], int l, int r, int x)
{
    if (l > r)
        return -1;
    int mid = (l + r) / 2;
    cout << l << " " << r << " " << mid << endl;
    if (arr[mid] == x)
        return mid;
    if (arr[mid] < x)
    {
        return binarysearch(arr, mid + 1, r, x);
    }
    if (arr[mid] > x)
    {
        return binarysearch(arr, l, mid - 1, x);
    }
    return -1;
}
int main()
{
	int k = 1000000;
    bool* prime = new bool[k + 1];
    memset(prime, true, sizeof(prime));

    for (int p = 2; p * p <= k; p++)
    {
        if (prime[p] == true)
        {
            for (int i = p * p; i <= k; i += p)
                prime[i] = false;
        }
    }
    int index = 0;
    int square[78498];
    for (int p = 2; p <= k; p++)
    {
        if (prime[p])
        {
            square[index] = p * p;
            index += 1;
        }
    }
    int t;
    cin >> t;
    while (t--)
    {
        long long n;
        cin >> n;
        long long z = binarysearch(square, 0, 78497, n);
        if (z == -1)
            cout << "NO" << endl;
        else
            cout << "YES" << endl;
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long* arr = new long long[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		long long t = sqrt(arr[i]);
		long long j = 2;
		bool cond = true;
		for (j = 2; j < t; j++)
		{
			if (t % j == 0)
		    {
			    cond = false;
			    break;
		    }
		}
		if (cond)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long* arr = new long long[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		long long t = arr[i];
		int j = 2;
		long long count = 0;
		for (; j < t; j++)
		{
			if (t % j == 0)
			{
				count += 1;
			}
			if (count > 1)
				break;
		}
		if (count == 1)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long* arr = new long long[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		bool square = false;
		for (long long k = 0; k <= arr[i] / 2; k++)
		{
			if (arr[i] == k * k)
			{
				square = true;
				break;
			}
		}
		if (square)
		{
			long long t = sqrt(arr[i]);
			long long j = 2;
			bool cond = true;
			for (j = 2; j < t; j++)
			{
				if (t % j == 0)
				{
					cond = false;
					break;
				}
			}
			if (cond)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
		else
			cout << "NO" << endl;
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int* arr = new int[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		int t = arr[i];
		int j = 2;
		int count = 0;
		for (; j < t; j++)
		{
			if (t % j == 0)
			{
				count += 1;
			}
		}
		if (count == 1)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int* arr = new int[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		int t = arr[i];
		int j = 2;
		int count = 0;
		for (; j < t; j++)
		{
			if (t % j == 0)
			{
				count += 1;
			}
		}
		if (count == 1)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
}


#include <iostream>
#include <cmath>
int n;long long x,t;bool flag=1;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;flag=1;t=sqrt(x);
  if(t*t!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<t&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");
    }
}


#include <iostream>
#include <cmath>
int n,counter;long long x;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;counter=0;
  for (long long i=2;i<=ceil(sqrt(x))&&counter<=2;i++)
     if (x%i==0)counter++;
  std::cout <<(counter==1?"YES\n":"NO\n");
  }
}


#include <iostream>
#include <cmath>
int n,t;long long x;bool flag=1;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;flag=1;t=sqrt(x);
  if(t*t!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<t&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");
    }
}


#include <iostream>
#include <cmath>
using namespace std;
int n,m;long long x,t;bool flag=1;
int main (){
  cin>>n;
  while (n--){
  cin>>x;flag=1;t=sqrt(x);
 if (t!=sqrt(x)){cout <<"NO\n";continue;}
 if(t%2==0 || t==1 ) {flag=0;}
   for (int i=2;i<sqrt(t)&&flag;i++){
     if (t%i==0)flag=0;
   } if (t==2)flag=1;
   cout << (flag?"YES\n":"NO\n");

 /* if (x==25||x==4){ cout <<"YES\n";continue;}
  else if (m%2==0||m==5)cout<<"NO\n";*/
  /*if(t*t!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<t&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");*/
    }
}


#include <iostream>
#include <cmath>
using namespace std;
int n,m;long long x,t;bool flag=1;
int main (){
  cin>>n;
  while (n--){
  cin>>x;flag=1;t=sqrt(x);
 if (t!=sqrt(x)){cout <<"NO\n";continue;}
   for (int i=2;i<sqrt(t);i++){
     if (t%i==0){flag=0;break;}
   } if (t==2)flag=1;
   cout << (flag?"YES\n":"NO\n");

 /* if (x==25||x==4){ cout <<"YES\n";continue;}
  else if (m%2==0||m==5)cout<<"NO\n";*/
  /*if(t*t!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<t&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");*/
    }
}


#include <iostream>
int n,x,counter;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;counter=0;
  for (int i=1;i<=x&&counter<=4;i++)if (x%i==0)counter++;
  std::cout <<(counter==3?"YES\n":"NO\n");
  }
}


#include <iostream>
#include <cmath>
int n;long long x;bool flag=1;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;flag=1;
  if(int(sqrt(x))*sqrt(x)!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<sqrt(x)&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");
    }
}


#include <iostream>
#include <cmath>
using namespace std;
int n,m;long long x,t;bool flag=1;
int main (){
  cin>>n;
  while (n--){
  cin>>x;flag=1;t=sqrt(x);
 if (t!=sqrt(x)){cout <<"NO\n";continue;}
 if(t%2==0 || t==1 ) {flag=0;}
   for (int i=2;i<=sqrt(t)&&flag;i++){
     if (t%i==0)flag=0;
   } if (t==2)flag=1;
   cout << (flag?"YES\n":"NO\n");

 /* if (x==25||x==4){ cout <<"YES\n";continue;}
  else if (m%2==0||m==5)cout<<"NO\n";*/
  /*if(t*t!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<t&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");*/
    }
}


#include <iostream>
#include <cmath>
int n;long long x;bool flag=1;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;flag=1;
  if(int(sqrt(x))*sqrt(x)!=x)flag=0;else
    for (long long i=2;i<sqrt(x)&&flag;i++)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");
    }
}


#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
int n;long long x,t;bool flag=1;
int main (){
  cin>>n;
  while (n--){
  cin>>x;flag=1;t=sqrt(x);
 if (t!=sqrt(x)){printf("NO\n");continue;}
 if(t%2==0 || t==1 ) {flag=0;}
   for (int i=3;i<=sqrt(t)&&flag;i+=2){
     if (t%i==0)flag=0;
   } if (t==2)flag=1;
   printf(flag?"YES\n":"NO\n");

    }
}


#include <iostream>
#include <cmath>
int n;long long x;bool flag=1;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;flag=1;
  if(int(sqrt(x))*sqrt(x)!=x||x==1)flag=0;else
    for (long long i=2;i<sqrt(x)&&flag;i++)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");
    }
}


#include <iostream>
#include <cmath>
int n,counter;long long x;bool flag=1;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;counter=0;
  if(int(sqrt(x))*sqrt(x)!=x)flag=0;else
    for (long long i=2;i<sqrt(x)&&flag;i++)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");
    }
}


#include <iostream>
int n,counter;long long x;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;counter=0;
  for (int i=1;i<=x&&counter<=4;i++)if (x%i==0)counter++;
  std::cout <<(counter==3?"YES\n":"NO\n");
  }
}


#include <iostream>
#include <cmath>
using namespace std;
int n,m;long long x,t;bool flag=1;
int main (){
  cin>>n;
  while (n--){
  cin>>x;flag=1;t=sqrt(x);
 if (t!=sqrt(x)){cout <<"NO\n";continue;}
 if(t%2==0 || t==1 ) {flag=0;}
   for (int i=3;i<=sqrt(t)&&flag;i+=2){
     if (t%i==0)flag=0;
   } if (t==2)flag=1;
   cout << (flag?"YES\n":"NO\n");

 /* if (x==25||x==4){ cout <<"YES\n";continue;}
  else if (m%2==0||m==5)cout<<"NO\n";*/
  /*if(t*t!=x||x==1||(x!=4&&x%2==0))flag=0;else
    for (long long i=3;i<t&&flag;i+=2)
       if (x%i==0)flag=0;
      std::cout << (flag?"YES\n":"NO\n");*/
    }
}


#include <iostream>
#include <cmath>
int n,counter;long long x;
int main (){
  std::cin>>n;
  while (n--){
  std::cin>>x;counter=0;
  for (long long i=2;i<=sqrt(x)&&counter<=2;i++)
     if (x%i==0)counter++;
  std::cout <<(counter==1?"YES\n":"NO\n");
  }
}


#include<iostream>
#include<bitset>
#include<cmath>
#define limit  1000001

using namespace std;

int main(){
    int sqt, temp;
    int n;
    long long int a[100005];
    bitset<limit> b;

    b[1] = 1;
    for(int i = 4; i <= limit; i += 2){
        b[i] = 1;
    }

    for(int i = 3; i <= limit; i += 2){
        if(b[i] == 0){
            temp = i;
            for(int j = i+temp; j <= limit; j = j + temp){
                b[j] = 1;
            }
        }
        else{
            temp = i;
            for(int j = i; j <= limit; j = j + temp){
                b[j] = 1;
            }
        }
    }

    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>a[i];

        sqt = sqrt(a[i]);

        if(((sqt*sqt) == a[i]) && (b[sqt] == 0)){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<bitset>
#include<cmath>
#define limit  1000005

using namespace std;

int main(){
    long long int sqt, temp;
    long long int n;
    long long int a[100005];
    bitset<limit> b;

    b[1] = 1;
    for(int i = 4; i < limit; i = i+2){
        b[i] = 1;
    }

    for(int i = 3; i < limit; i = i+2){
        if(b[i] == 0){
            temp = i;
            for(int j = i+temp; j < limit; j = j + temp){
                b[j] = 1;
            }
        }
        else{
            temp = i;
            for(int j = i; j < limit; j = j + temp){
                b[j] = 1;
            }
        }
    }

    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>a[i];
        temp = a[i];
        sqt = sqrt(temp);

        temp = sqt*sqt;
        if((temp == a[i]) && (b[sqt] == 0)){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, count;
    int a[100005];
    bitset<100005> b;

    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>a[i];
        if(b[i] == 0){
            count = 0;
            for(int j = 2; j < a[i]; j++){
                if(a[i] % j == 0){
                    count++;
                }
            }
            if(count == 1){
                cout<<"YES"<<endl;
                for(int j = a[i]; j <= n; j += a[i] ){
                    b[j] = 1;
                }
            }
            else{
                cout<<"NO"<<endl;
            }
        }
        else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<bitset>

using namespace std;

int main()
{
    int n, count;
    int a[100005];
    bitset<100005> b;

    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>a[i];
        if(b[i] == 0){
            count = 0;
            for(int j = 2; j < a[i]; j++){
                if(a[i] % j == 0){
                    count++;
                }
            }
            if(count == 1){
                cout<<"YES"<<endl;
                for(int j = a[i]; j <= n; j += a[i] ){
                    b[j] = 1;
                }
            }
            else{
                cout<<"NO"<<endl;
            }
        }
        else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<bitset>
#include<cmath>
#define limit  1000001

using namespace std;

int main(){
    bitset<limit> b;
    long long int sqt, temp;
    long long int n;
    long long int a[100005];

    b[1] = 1;
    for(int i = 4; i <= limit; i += 2){
        b[i] = 1;
    }

    for(int i = 3; i <= limit; i += 2){
        if(b[i] == 0){
            temp = i;
            for(int j = i+temp; j < limit; j = j + temp){
                b[j] = 1;
            }
        }
        else{
            temp = i;
            for(int j = i; j < limit; j = j + temp){
                b[j] = 1;
            }
        }
    }

    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>a[i];

        sqt = sqrt(a[i]);

        if(((sqt*sqt) == a[i]) && (b[sqt] == 0)){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,k;
    cin >> n;
    for (int i = 0;i < n;i++)
    {
        vector<int> v;
        cin >> k;
        int sq = sqrt(k);
        for (int j = 1;j <= sq;j++)
        {
            if (k % j == 0)
            {
                v.emplace_back(j);
                float r = k / j;
                if (r != sq)
                    v.emplace_back(r);
                if (v.size() > 3)
                {
                    cout << "NO" << endl;
                    break;
                }
            }
        }
        if (v.size() == 3)
            cout << "YES" << endl;
        else if (v.size() < 3)
            cout << "NO" << endl;
    }

}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    // solution 1 :  TIME_LIMIT_EXCEEDED for huge data.
   /* int n; long long k;
    cin >> n;
    for (int i = 0;i < n;i++)
    {
        vector<int> v;
        cin >> k;
        long long sq = sqrt(k);
        for (long long j = 1;j <= sq;j++)
        {
            if (k % j == 0)
            {
                v.emplace_back(j);
                long long r = k / j;
                if (r != sq)
                    v.emplace_back(r);
                if (v.size() > 3)
                {
                    cout << "NO" << endl;
                    break;
                }
            }
        }
        if (v.size() == 3)
            cout << "YES" << endl;
        else if (v.size() < 3)
            cout << "NO" << endl;
    }*/

    // solution 2 :

    const int N = 1000000;  // from problem text 1 ≤ x i ≤ 10^12  ==> sqrt(10^12)= 10^6

    //start  sieve algorithm for extraxt prime number
    bool isprime[N + 1];
    isprime[0] = isprime[1] = false;
    for (int i = 2; i <= N; i++) {
        isprime[i] = true;
    }

    for (int i = 2; i * i <= N; i++) {

        if (isprime[i]) {
            //cout << i << "  ";
            for (long long j = i * i; j <= N; j += i) {  // long long because i*i is 1e12 (10^12)
                isprime[j] = false;
            }
        }
    }
    //end  sieve algorithm

    int  n;
    long long x;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x;

        long long sqr = sqrt(x);   //sqrt  need #include<cmath>

        if (sqr * sqr == x)
        {
            if (isprime[sqr] == true)
                cout << "YES" << endl;
            else
                cout << "NO" << endl;

        }
        else
            cout << "NO" << endl;

    }

}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,k;
    cin >> n;
    vector<int> v;
    for (int i = 0;i < n;i++)
    {
        cin >> k;
        int sq = sqrt(k);
        for (int i = 1;i <= sq;i++)
        {
            v.emplace_back(i);
            int r = k / i;
            if (r != sq)
                v.emplace_back(r);
            if (v.size() > 3 )
            {
                cout << "NO" << endl;
                break;
            }
        }
        if (v.size() == 3)
            cout << "YES" << endl;
        else if (v.size() < 3)
            cout << "NO" << endl;
    }
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n; long long k;
    cin >> n;
    for (int i = 0;i < n;i++)
    {
        vector<int> v;
        cin >> k;
        long long sq = sqrt(k);
        for (long long j = 1;j <= sq;j++)
        {
            if (k % j == 0)
            {
                v.emplace_back(j);
                long long r = k / j;
                if (r != sq)
                    v.emplace_back(r);
                if (v.size() > 3)
                {
                    cout << "NO" << endl;
                    break;
                }
            }
        }
        if (v.size() == 3)
            cout << "YES" << endl;
        else if (v.size() < 3)
            cout << "NO" << endl;
    }

}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,k;
    cin >> n;
    vector<int> v;
    for (int i = 0;i < n;i++)
    {
        cin >> k;
        int sq = sqrt(k);
        for (int i = 1;i <= sq;i++)
        {
            v.emplace_back(i);
            int r = k / i;
            if (r != k)
                v.emplace_back(r);
            if (v.size() > 3)
            {
                cout << "NO" << endl;
                break;
            }
        }
        if(v.size()==3)
            cout << "YES" << endl;
    }
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,k;
    cin >> n;
    for (int i = 0;i < n;i++)
    {
        vector<int> v;
        cin >> k;
        int sq = sqrt(k);
        for (int i = 1;i <= sq;i++)
        {
            v.emplace_back(i);
            int r = k / i;
            if (r != sq)
                v.emplace_back(r);
            if (v.size() > 3 )
            {
                cout << "NO" << endl;
                break;
            }
        }
        if (v.size() == 3)
            cout << "YES" << endl;
        else if (v.size() < 3)
            cout << "NO" << endl;
    }

}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,k;
    cin >> n;
    vector<int> v;
    for (int i = 0;i < n;i++)
    {
        cin >> k;
        int sq = sqrt(k);
        for (int i = 1;i <= sq;i++)
        {
            v.emplace_back(i);
            int r = k / i;
            if (r != sq)
                v.emplace_back(r);
            if (v.size() > 3)
            {
                cout << "NO" << endl;
                break;
            }
        }
        if(v.size()==3)
            cout << "YES" << endl;
    }
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn)||a[i]==1)
    {
        cout<<"NO"<<"\n";
        continue;
    }c=0;
    int nnn=int(nn);
        for(j=1;j<=int(sqrt(nn));j++)
        {
            if(nnn%j==0)
            c++;
            if(c>1)
            break;
        }
        if(c>1)
        {
            cout<<"NO"<<"\n";
        }
        else
        {
            cout<<"YES"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn))
    {
        cout<<"No"<<"\n";
        continue;
    }c=0;
    nn=int(nn);
        for(j=1;j<=sqrt(nn);j++)
        {
            if(nn%j==0)
            c++;
            if(c>2)
            break;
        }
        if(c>2)
        {
            cout<<"No"<<"\n";
        }
        else
        {
            cout<<"Yes"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn)||a[i]==1)
    {
        cout<<"NO"<<"\n";
        continue;
    }c=0;
    int nnn=int(nn);
        for(j=1;j<=int(sqrt(nn));j++)
        {
            if(nnn%j==0)
            c++;
            if(c>2)
            break;
        }
        if(c>2)
        {
            cout<<"NO"<<"\n";
        }
        else
        {
            cout<<"YES"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn))
    {
        cout<<"NO"<<"\n";
        continue;
    }c=0;
    int nnn=int(nn);
        for(j=1;j<=int(sqrt(nn));j++)
        {
            if(nnn%j==0)
            c++;
            if(c>2)
            break;
        }
        if(c>2)
        {
            cout<<"NO"<<"\n";
        }
        else
        {
            cout<<"YES"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    /*cout<<nn<<"\n";
    cout<<a[i]<<"\n";*/
    if(nn!=floor(nn)||a[i]==1)
    {
        cout<<"NO"<<"\n";
        continue;
    }c=0;
    int nnn=int(nn);
        for(j=1;j<=int(sqrt(nn));j++)
        {
            if(nnn%j==0)
            c++;
            if(c>1)
            break;
        }
        if(c>1)
        {
            cout<<"NO"<<"\n";
        }
        else
        {
            cout<<"YES"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn))
    {
        cout<<"No"<<"\n";
        continue;
    }c=0;
        for(j=1;j<=int(sqrt(nn));j++)
        {
            if(nn%j==0)
            c++;
            if(c>2)
            break;
        }
        if(c>2)
        {
            cout<<"No"<<"\n";
        }
        else
        {
            cout<<"Yes"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    int nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn))
    {
        cout<<"No"<<"\n";
        continue;
    }c=0;
        for(j=1;j<=sqrt(nn);j++)
        {
            if(nn%j==0)
            c++;
            if(c>2)
            break;
        }
        if(c>2)
        {
            cout<<"No"<<"\n";
        }
        else
        {
            cout<<"Yes"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn))
    {
        cout<<"NO"<<"\n";
        continue;
    }c=0;
    int nnn=int(nn);
        for(j=1;j<=int(sqrt(nn));j++)
        {
            if(nnn%j==0)
            c++;
            if(c>1)
            break;
        }
        if(c>1)
        {
            cout<<"NO"<<"\n";
        }
        else
        {
            cout<<"YES"<<"\n";
        }
    }
return 0;

}


#include<iostream>
#include<math.h>
using namespace std;
long int a[1000000];
int main()
{int n;
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
    cin>>a[i];
    double nn;int c;
    for(i=0;i<n;i++)
    {
    nn=sqrt(a[i]);
    if(nn!=floor(nn))
    {
        cout<<"No"<<"\n";
        continue;
    }c=0;
        for(j=1;j<=sqrt(nn);j++)
        {
            if(nn%j==0)
            c++;
            if(c>2)
            break;
        }
        if(c>2)
        {
            cout<<"No"<<"\n";
        }
        else
        {
            cout<<"Yes"<<"\n";
        }
    }
return 0;

}


#include <cstdlib>
#include <array>
#include <iostream>
#include <limits>
#include <vector>

const double metricEps = 1e-16;
const double metricEps2 = metricEps * metricEps;

struct Point2
{
    Point2() {};
    Point2(
        int _x,
        int _y,
        int _i)
    :   x(_x),
        y(_y),
        i(_i)
    {}

    double operator%(const Point2& point) const
    {
        return x * point.y - y * point.x;
    };

    Point2 operator-(const Point2& point) const
    {
        return Point2(x - point.x, y - point.y, i);
    }

    Point2 operator+(const Point2& point) const
    {
        return Point2(x + point.x, y + point.y, i);
    }

    double distance2(const Point2& point) const
    {
        double dx = x - point.x;
        double dy = y - point.y;
        return dx * dx + dy * dy;
    }

    int x;
    int y;
    int i;
};

struct Line2
{
    Point2 beg, end;

    double distance2(const Point2& point) const
    {
        double area = ((beg - point) % (end - point)) / 2.0;
        return area * area / beg.distance2(end);
    }
};

typedef std::array<std::size_t, 3> Triangle;

typedef std::vector<Point2> Cloud;

Triangle FindTriangle(const Cloud& cloud)
{
    Triangle triangle;
    triangle[0] = 0;
    triangle[1] = 1;

    Line2 line;
    line.beg = cloud[triangle[0]];
    line.end = cloud[triangle[1]];

    double minDistance2 = std::numeric_limits<double>::max();
    for (std::size_t pointId = 0; pointId < cloud.size(); pointId++)
    {
        const Point2& point = cloud[pointId];
        double distance2 = line.distance2(point);
        if (distance2 > metricEps2)
        {
            if (distance2 < minDistance2 - metricEps2)
            {
                minDistance2 = distance2;
                triangle[2] = pointId;
            }
        }
        else
        {
            double distToBeg2 = line.beg.distance2(point);
            if ((distToBeg2 > metricEps2) && (distToBeg2 < line.beg.distance2(line.end) - metricEps2))
            {
                line.end = point;
                triangle[1] = pointId;
            }
        }
    }

    return triangle;
}

Cloud ReadPoints()
{
    std::size_t nPoints = 0;
    std::cin >> nPoints;

    Cloud points(nPoints, Point2(0, 0, 0));

    for (std::size_t i = 0; i < nPoints; ++i)
    {
        int x, y;
        std::cin >> x >> y;
        points[i] = Point2(x, y, i + 1);
    }

    return points;
}

int main()
{
    Cloud cloud = ReadPoints();
    Triangle triangle = FindTriangle(cloud);

    std::cout << cloud[triangle[0]].i << ' ' << cloud[triangle[1]].i << ' ' << cloud[triangle[2]].i;

    return 0;
}


// Engineered by cnc.algo@gmail.com
#include <array>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>

struct Point2
{
    Point2(
        const int x,
        const int y,
        const int i)
    :   _x(x),
        _y(y),
        _i(i)
    {}

    bool operator<(const Point2& other)
    {
        if (_x < other._x) return true;
        if (_x > other._x) return false;
        if (_y < other._y) return true;
        return false;
    }

    long long _x;
    long long _y;
    int _i;
};

typedef std::vector<Point2> Points;

Points ReadPoints()
{
    std::size_t nPoints = 0;
    std::cin >> nPoints;

    Points points(nPoints, Point2(0, 0, 0));

    for (std::size_t i = 0; i < nPoints; ++i)
    {
        int x, y;
        std::cin >> x >> y;
        points[i] = Point2(x, y, i + 1);
    }

    return points;
}

void DisplayPoints(const Points& points)
{
    for (const auto& point : points)
    {
        std::cout << point._x << ' ' << point._y << std::endl;
    }
}

void SortPoints(Points& points)
{
    std::sort(
        points.begin(),
        points.end());
}

bool IsOnSameLine(
    const Point2& a,
    const Point2& b,
    const Point2& c)
{
    const long long signedParallelogramArea =
        (a._x - c._x) * (b._y - c._y)
        - (a._y - c._y) * (b._x - c._x);

    return signedParallelogramArea == 0;
}

void Print(
    const int a,
    const int b,
    const int c)
{
    std::cout << a << ' ' << b << ' ' << c;
}

inline bool XCompare(const Point2 &point1, const Point2 &point2)
{
	return point1._x < point2._x || point1._x == point2._x && point1._y < point2._y;
}

std::array<std::size_t, 3> Solve(const std::vector<Point2>& points)
{
	std::vector<Point2> pointsByX = points;
	std::sort(pointsByX.begin(), pointsByX.end(), XCompare);

	int i;
	for (i = 0; (long long)((pointsByX[i + 2]._x - pointsByX[i]._x)*(pointsByX[i + 1]._y - pointsByX[i]._y)) ==
				(long long)((pointsByX[i + 1]._x - pointsByX[i]._x)*(pointsByX[i + 2]._y - pointsByX[i]._y)); ++i);
	std::array<size_t, 3> triangle;
	triangle[0] = pointsByX[i]._i;
	triangle[1] = pointsByX[i + 1]._i;
	triangle[2] = pointsByX[i + 2]._i;
	return triangle;
}

int main()
{
    Points points = ReadPoints();

    const auto solution = Solve(points);

    std::cout << solution[0] << ' ' << solution[1] << ' ' << solution[2];

    //SortPoints(points);

    //for (std::size_t i = 2; i < points.size(); ++i)
    //{
    //    const bool isOnSameLine = IsOnSameLine(
    //        points[i - 2],
    //        points[i - 1],
    //        points[i]);

    //    if (!isOnSameLine)
    //    {
    //        Print(
    //            points[i - 2]._i,
    //            points[i - 1]._i,
    //            points[i]._i);

    //        break;
    //    }
    //}

    return 0;
}


#include <iostream>
#include <cstdint>
#include <cstdlib>
#include <array>
#include <vector>

namespace task_1 {

struct Point2 {
    Point2(int _x, int _y) : x(_x), y(_y) {}
  int x;
  int y;
};

/*
 *  Вращение на плоскости
 */
enum TurnEnum {
  kLeftTurn = -1,
  kCollinear = 0,
  kRightTurn = 1
};

/*
 *  Возвращает вращение точки c относительно вектора (a, b)
 *  Вращение определяется через знак косого произведения векторов
 */
TurnEnum TurnPredicate(const Point2 &a, const Point2 &b, const Point2 &c) {
  const std::int64_t cross_product =
      (static_cast<std::int64_t>(c.x - a.x)) * (static_cast<std::int64_t>(b.y - a.y))
       - (static_cast<std::int64_t>(b.x - a.x)) * (static_cast<std::int64_t>(c.y - a.y));
  if (cross_product < 0)
    return kLeftTurn;
  else if (cross_product > 0)
    return kRightTurn;
  else
    return kCollinear;
}

/*
 * Возвращает true когда точка p1 расположена между точками p0 и p2
 * Точки p1, p2, p3 находятся на одной прямой.
 * Расположение точки определяется через знак скалярного произведения.
 */
bool IsMiddlePointBetween(const Point2 &p0,
                          const Point2 &p1,
                          const Point2 &p2) {
//преобразуем 3 точки в два вектора
  std::int64_t a_x = p0.x - p1.x;
  std::int64_t a_y = p0.y - p1.y;
  std::int64_t b_x = p2.x - p1.x;
  std::int64_t b_y = p2.y - p1.y;
  //Точка p1 расположена между точками p0 и p2
  // когда скалярное происзведение отрицательно.
  return ((a_x * b_x + a_y * b_y) < 0);
}

/*
 * Задача 1
 * В заданном облаке точек на плоскости (каждая точка определяется двумя целочисленными
 * координатами: x, y) найти 3 любые точки, которые образуют невырожденный треугольник
 * (имеющий ненулевую площадь). Все остальные точки должны находиться строго за
 * пределами этого треугольника. Заданные точки не принадлежат одной прямой. Никакие две
 * точки не находятся в одной позиции. Количество точек может быть от 3 до 1е5. Каждая из
 * заданных координат может находиться в пределах от -1е9 до 1е9. Метод Solve() принимает
 * облако точек, заданных в плоскости, и возвращает 3 индекса точек из заданного облака,
 * удовлетворяющих решению поставленной задачи
 *
 * Входные данные: points - облако точек
 * Выходные данные: массив из трех найденных индексов
 *
 * Алгоритм:
 * Положим начальную точку (idx_0=0) в облаке вершиной искомого
 * треугольника. Далее эта вершина менятся не будет.
 * Допустим, что следующая точка так же является вершиной.
 * Проверяем все оставшиеся точки:
 * Если точка принадлежит одной из сторон треугольника (коллинеарна
 * стороне и расположена между вершинами) - заменяем  одну из вершин
 * этой стороны.
 * Если треугольник еще не определен,
 * определяем его.
 * Если точка находится внутри треугольника - она становится новой вершиной.
  */
std::array<std::size_t, 3> Solve(const std::vector<Point2> &points) {
  //индексы точек, образующих возвращаемый треугольник
  constexpr std::size_t idx_0 = 0;
  std::size_t idx_1 = 1;
  std::size_t idx_2 = 0;  // 0 - признак того, что вершина еще неопределена

  for (std::size_t i = 2; i < points.size(); ++i) {
    TurnEnum turn_1 = TurnPredicate(points[i], points[idx_0], points[idx_1]);
    if (turn_1 == TurnEnum::kCollinear) {
      if (IsMiddlePointBetween(points[idx_0], points[i], points[idx_1]))
        idx_1 = i;
      continue;
    } else {
      // если треугольник еще не определен, определяем его
      if (idx_2 == 0) {
        idx_2 = i;
        continue;
      }
    }
    TurnEnum turn_2 = TurnPredicate(points[i], points[idx_1], points[idx_2]);
    if (turn_2 == TurnEnum::kCollinear) {
      if (IsMiddlePointBetween(points[idx_1], points[i], points[idx_2]))
        idx_2 = i;
      continue;
    }
    TurnEnum turn_3 = TurnPredicate(points[i], points[idx_2], points[idx_0]);
    if (turn_3 == TurnEnum::kCollinear) {
      if (IsMiddlePointBetween(points[idx_0], points[i], points[idx_2]))
        idx_2 = i;
      continue;
    }
    //Если у точки одинаковое вращение относительно каждой стороны треугольника,
    //значит точка находится внутри треугольника, и необходимо перенести
    // вершину треугольника
    if ((turn_1 == turn_2) && (turn_2 == turn_3))
      idx_2 = i;
  }
  return {idx_0, idx_1, idx_2};
}

typedef std::vector<Point2> Points;

Points ReadPoints()
{
    std::size_t nPoints = 0;
    std::cin >> nPoints;

    Points points(nPoints, Point2(0, 0));

    for (std::size_t i = 0; i < nPoints; ++i)
    {
        int x, y;
        std::cin >> x >> y;
        points[i] = Point2(x, y);
    }

    return points;
}

void Print(
    const std::size_t a,
    const std::size_t b,
    const std::size_t c)
{
    std::cout << a << ' ' << b << ' ' << c;
}
}  // namespace task_1

int main() {

    std::vector<task_1::Point2> points = task_1::ReadPoints();

    std::array<std::size_t, 3> r = task_1::Solve(points);

    task_1::Print(r[0] + 1, r[1] + 1, r[2] + 1);

  return 0;
}