#愚直解 s=[1] for i in range(2,60): j=2 while j<=10**6 and j**i<=10**18: s.append(j**i) j+=1 t=int(input()) for _ in range(t): k=int(input()) print(s[k-1])