import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = 10**5 a = [0]*n primes = [] for i in range(2,n): if a[i]==0: primes.append(i) for j in range(i,n,i): a[j] = 1 for _ in range(ni()): n = ni() c = 0 for p in primes: if n%p==0: while n%p==0: n//=p c += 1 if c > 3: break if n > 1: c += 1 if c == 3: Yes() else: No()