def seachPrimeNum(N): if N == 2: return [] max = int(N ** 0.5) seachList = [i for i in range(2, N + 1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum PL = seachPrimeNum(10 ** 5) for _ in range(int(input())): a = int(input()) cnt = 0 j = False for p in PL: while cnt < 3 and a % p == 0: a //= p cnt += 1 if a == 1: if cnt == 3: j = True break else: break else: if cnt == 2: j = True if j == True: print("Yes") else: print("No")