#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def MillerRabinTest(n, maxiter=20): import random if n == 1: return False elif n == 2: return True if not n & 1: return False d = n - 1 while not (d & 1): d >>= 1 for _ in range(maxiter): a = random.randint(1, n - 1) t = d x = pow(a, t, n) while (t != n - 1) and (x != 1) and (x != n - 1): x = x * x % n t <<= 1 if (x != n - 1) and not (t & 1): return False return True def is_pp(N): if N <= 1: return False for n in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]: m = int(N ** (1 / n) + .5) if m ** n == N: return is_pp(m) return MillerRabinTest(N) def solve(N): if N == 2: return False if N % 2 == 0: return True for n in range(1, 64): x = 1 << n if x >= N: return False if is_pp(N - x): return True Q, *N = map(int, read().split()) print('\n'.join('Yes' if solve(n) else 'No' for n in N))