def isprime(n): if n <= 1: return False elif n == 2: return True elif n % 2 == 0: return False A = [2, 325, 9375, 28178, 450775, 9780504, 1795265022] s = 0 d = n - 1 while d % 2 == 0: s += 1 d >>= 1 for a in A: if a % n == 0: return True x = pow(a, d, n) if x != 1: for t in range(s): if x == n - 1: break x = x * x % n else: return False return True def invc(x, c): i = int(x ** (1 / c)) while i ** c < x: i += 1 while i ** c > x: i -= 1 return i def ok(x): if isprime(x): return True c = 2 while 1: i = invc(x, c) if i <= 2: break if i ** c == x: return True c += 1 return False def solve(x): if x == 2: print("No") return if not x & 1: print("Yes") return b = 2 while b < x: if ok(x - b): print("Yes") return b *= 2 print("No") for _ in range(int(input())): solve(int(input()))