Q = int(input()) A = [int(input()) for _ in range(Q)] def eratosthenes(n): sieve = [True] * (n + 1) for i in range(int(n**0.5) + 1): if i < 2: sieve[i] = False elif sieve[i]: for j in range(2, n//i + 1): sieve[i * j] = False ans = [] for i in range(n+1): if sieve[i]: ans.append(i) return ans prime = eratosthenes(10**5) D = dict() for i in range(Q): if A[i] in D: if D[A[i]] == 3: print("Yes") else: print("No") continue N = A[i] cnt = 0 idx = 0 while N >= 2 and idx < len(prime): while N % prime[idx] == 0: N //= prime[idx] cnt += 1 idx += 1 if idx == len(prime): cnt += 1 D[A[i]] = cnt if cnt == 3: print("Yes") else: print("No")