import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) def hurui(n): """線形篩 pl: 素数のリスト mpf: iを割り切る最小の素因数 """ pl = [] mpf = [None]*(n+1) for d in range(2,n+1): if mpf[d] is None: mpf[d] = d pl.append(d) for p in pl: if p*d>n or p>mpf[d]: break mpf[p*d] = p return pl, mpf from collections import defaultdict def factor(num): d = defaultdict(int) if num==1: d.update({1:1}) return d while num>1: d[mpf[num]] += 1 num //= mpf[num] return d from math import gcd def rho(n): """nの素数判定 素数のとき0, 合成数の時見つかった約数を返す """ y = 2 l = [1,2] i = 0 while 1: x = l[i] g = gcd(abs(x-y), n) if g==n: return 0 elif g>1: return g y = (y*y + 1) % n l.append(y) y = (y*y + 1) % n l.append(y) i += 1 def inv_pow(v,b): """x**b == v なるxが存在すればそれを返す 存在しない場合、Noneを返す """ assert v>=0 if v==0: return 0 l = 0 r = v+1 while r-l>1: m = (r+l)//2 p = pow(m,b) if p>v: r = m elif pn: break qq = q for b in range(1,100): if qq>n: break if pp+qq==n: print("Yes") # print(p,q,a,b) return qq *= q # print(pp,qq) pp *= p print("No") def sub1(n): if n%2==0: print("Yes") else: pp = 2 for a in range(1,100): if pp>n: print("No") return v = n - pp # print(v) for b in range(1,100): val = inv_pow(v, b) if val is not None: # print(val) if rho(int(val))==0: print("Yes") return pp *= 2 q = int(input()) pl, mpf = hurui(5000) m = len(pl) for i in range(q): n = int(input()) if n<50: sub0(n) else: sub1(n)