def prime(n: int) -> list: lis = [] queue = [i for i in range(n, 1, -1)] dic = {i: True for i in range(1, n+1)} while queue: a = queue.pop() if not dic[a]: continue lis.append(a) dic[a] = False for i in range(2, n//a+1): if a * i <= n and dic[a*i]: dic[a*i] = False return lis def f(n): if n == 1: return 0 init = n cnt = 0 for i in prime_lst: if n % i == 0: while n % i == 0: n //= i cnt += 1 if 3 < cnt: return 0 if n != 1: cnt += 1 return cnt == 3 Q = int(input()) prime_lst = prime(10**7) for _ in range(Q): a = int(input()) if f(a): print('Yes') else: print('No')