#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); i64 modpow(i64 a, i64 n, i64 mod) { if (n == 0) return 1; if (n % 2 == 0) { i64 t = modpow(a, n / 2, mod); return t * t % mod; } return a * modpow(a, n - 1, mod) % mod; } bool is_prime(i64 n, int k = 10) { if (n == 2) return true; if (n < 2 || n % 2 == 0) return false; i64 d = n - 1; while (d % 2 == 0) { d /= 2; } for (int i = 0; i < k; i++) { i64 a = rnd() % (n - 2) + 1; i64 t = d; i64 y = modpow(a, t, n); while (t != n - 1 && y != 1 && y != n - 1) { y = modpow(y, 2, n); t *= 2; } if (y != n - 1 && t % 2 == 0) { return false; } } return true; } bool powle(i64 n, int k, i64 m) { __int128_t ret = 1; for (int i = 0; i < k; i++) { ret *= n; if (ret > m) { return false; } } return ret <= m; } i64 ksqrt(i64 n, int k) { i64 l = 1, r = n; while (l < r - 1) { i64 m = (l + r) / 2; if (powle(m, k, n)) { l = m; } else { r = m; } } return l; } __int128_t powi(i64 n, int k) { __int128_t ret = 1; for (int i = 0; i < k; i++) { ret *= n; } return ret; } int main() { int q; cin >> q; while (q--) { i64 n; cin >> n; if (n <= 2) { cout << "No" << endl; } else if (n % 2 == 0) { cout << "Yes" << endl; } else { int ok = 0; for (i64 i = 2; i < n; i <<= 1) { if (ok) break; i64 k = n - i; if (is_prime(k)) { cout << "Yes" << endl; ok = 1; break; } if (!ok) { for (int j = 2;; j++) { i64 s = ksqrt(k, j); if (s == 1) break; if (powi(s, j) == k) { cout << "Yes" << endl; ok = 1; break; } } } } if (!ok) { cout << "No" << endl; } } } }