import math ps=[True]*(10**5) ps[0], ps[1]=False, False for i in range(2, len(ps)): j=2 if ps[i]==False: continue while i*jkijun: continue while x%elm==0: x//=elm count+=1 if count>3: return 0 if x!=1: count+=1 return [0, 1][count==3] for _ in range(Q): print(["No", "Yes"][isOk(int(input()))])