from math import isqrt def primes(n): ps = [2] t = [True] * (n + 1) for i in range(3, n+1, 2): if t[i]: ps.append(i) for j in range(i+i, n+1, i): t[j] = False return ps ps = primes(isqrt(10 ** 10) + 10) Q = int(input()) for _ in range(Q): A = int(input()) x = A cnt = 0 for p in ps: while x % p == 0: x //= p cnt += 1 if cnt > 3: break if x > 1: cnt += 1 print('Yes' if cnt == 3 else 'No')