import sys input = sys.stdin.readline import math def main(): B = set([]) MAX = pow(10,6) + 10 L = [2] for i in L: for x in range(2,pow(10,3) + 10): v = pow(x, i) if v <= MAX: B.add(v) #print(B) B = list(B); B.sort() #A[x]: x以下の平方数の値(ただし1を除く) A = [0]*MAX #A[1] = 1 for i in range(2,MAX): if i in B: A[i] = A[i-1] + 1 else: A[i] = A[i-1] #print(A[:100]) #print(check(10)) T = int(input()) for _ in range(T): K = int(input()) ok = pow(10,18) ng = 0 while abs(ok - ng) > 1: mid = (ok + ng)//2 if check(mid,A) >= K : ok = mid else: ng = mid print(ok) def check(x,A): ret = 1 #1の分 L = [2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59] for i in L: #i乗根以下の素数 if pow(2,i) > x: break ok = 2 ng = math.ceil(x ** (1/i)) + 10 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if pow(mid,i) <= x: ok = mid else: ng = mid #print(i,ok) if i == 2: ret += ok - 1 else: ret += ok - 1 - A[ok] return ret if __name__ == "__main__": main()