from bisect import bisect M = 10**18 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 sq = set() for i in S[1:]: for j in range(2, 10**6+1): if pow(j, i) >= M: break sq.add(pow(j, i)) sq = sorted(list(sq)) def countSquare(ct): l = 0 r = 10**9+1 while r-l > 1: m = (l+r)//2 if m**2 > ct: r = m else: l = m return l def solve(K): l = 0 r = 10**18 while r-l > 1: m = (l+r)//2 ct = countSquare(m)+bisect(sq, m) if ct >= K: r = m else: l = m return r def main(): T = int(input()) ans = [0]*T for i in range(T): ans[i] = solve(int(input())) print(*ans, sep='\n') main()