def get_prime(n): sieve = [True] * (n + 1) i = 2 while i * i <= n: if sieve[i]: for j in range(i * i, n + 1, i): sieve[j] = False i += 1 return [i for i in range(2, n + 1) if sieve[i]] l = get_prime(4000) # print(l) q = int(input()) for _ in range(q): n = int(input()) if n==1: print('No') continue cnt=0 for i in l: if n%i == 0: n = n//i cnt+=1 for i in l: if n%i == 0: n = n//i cnt+=1 for i in l: if n%i == 0: n = n//i cnt+=1 if n==1 and cnt==3: print('Yes') else: print('No')