#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll qpow(ll a, ll b, ll m)
{
    ll r = 1;
    for (; b; b >>= 1, a = a * a % m)
        if (b & 1)
            r = r * a % m;
    return r;
}
bool test(ll n, ll a, ll d)
{
    if (n == 2) return true;
    if (n == a) return false;
    if (!(n & 1)) return false;
    while (!(d & 1)) d >>= 1;
    ll t = qpow(a, d, n);
    while (d != n - 1 && t != n - 1 && t != 1)
    {
        t = t * t % n;
        d <<= 1;
    }
    return t == n - 1 || (d & 1) == 1;
}
bool isprime(ll x)
{
    if (x == 1 || x == 2) return true;
    int a[] = {2, 3, 5, 7, 11, 13, 17, 19};
    for (int i = 0; i < 8; i++)
    {
        if (a[i] == x) return true;
        if (!test(x, a[i], x - 1)) return false;
    }
    return true;
}
int main()
{
    /*set<int> S;
    for (int i = 1; i <= 100; i++)
        for (int j = 1; j <= 100; j++)
            for (int k = 1; k <= 100; k++)
                for (int l = 1; l <= 100; l++)
                    if (i * j == k * l)
                        S.insert(i + j + k + l);
    for (int i = 1; i <= 400; i++)
        if (S.count(i) == 0)
            cout << i << " ";*/
    int T, n;
    scanf("%d", &T);
    while (T--)
        scanf("%d", &n), puts(isprime(n) ? "No" : "Yes");
    return 0;
}
