from functools import lru_cache T = int(input()) S = [] isprime = [1]*61 for i in range(2, 61): if isprime[i]: S.append(i) for j in range(i*i, 61, i): isprime[j] = 0 @lru_cache(maxsize=None) def count(N, K): l = 1 r = N**2+1 while r-l > 1: m = (l+r)//2 if pow(m, K) <= N: l = m else: r = m return l @lru_cache(maxsize=None) def solve(N): l = 0 r = 10**18+1 while r-l > 1: m = (l+r)//2 ct = 1 for k in S: ct += count(m, k)-1 if ct < N: l = m else: r = m return r ans = [0]*T for i in range(T): N = int(input()) ans[i] = solve(N) print(*ans, sep='\n')