import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = 10**20 # md = 998244353 md = 10**9+7 pp = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67] def cnt(a): res = 1 for e in pp: if 1 << e > a: # print(e) break b = max(2, round(a**(1/e))-3) while b**e < a: b += 1 # print(e, b) res += b-2 return res def solve(): k = II() if k==1: print(1) return l, r = 0, 10**18 while l+1 < r: m = (l+r)//2 if cnt(m) < k: l = m else: r = m print(l) for _ in range(II()): solve()