import random def mr_test_normal(n: int): assert n > 1 if n == 2: return True elif n%2 == 0: return False d = n - 1 s = 0 while d & 1 == 0: s += 1; d >>= 1 k = 20 for _ in range(k): a = random.randint(2, n-1) x = pow(a, d, n) # a^d mod n if x == 1 or x == n-1: continue for _ in range(s): x = pow(x, 2, n) if x == n-1: # a^(d*2^r) mod n break else: return False return True P=[] prime = [True for i in range(10**7+1)] p = 2 while (p * p <= 10**7+1): if prime[p] ==1: P.append(p) for i in range(p * 2, 10**7+1, p): prime[i] = 0 p += 1 l=len(P) t=int(input()) for _ in range(t): n=int(input()) flag=0 for i in range(l): if n%P[i]==0: n//=P[i] for j in range(i,l): if n%P[j]==0: n//=P[j] if n==1:break if mr_test_normal(n): flag=1 break if flag: break print("Yes" if flag else "No")