def f(n): if n == 1: return 0 init = n i = 2 cnt = 0 while 1 < n: if init < i**2: break if n % i == 0: while n % i == 0: n //= i cnt += 1 i += 1 if n != 1: cnt += 1 return cnt == 3 Q = int(input()) for _ in range(Q): a = int(input()) if f(a): print('Yes') else: print('No')