import sys input = sys.stdin.readline import bisect S=[] for p in range(3,65): for i in range(1,10**6+5): S.append(i**p) if i**p>10**18: break S=sorted(set(S)) T=[] for s in S: r=int(s**(1/2)) if r**2==s or (r+1)**2==s or (r-1)**2==s: continue T.append(s) def calc(x): if x==1: return 1 y=int(x**(1/2)) while y*y>x: y-=1 k=bisect.bisect(T,x) return y+k t=int(input()) for tests in range(t): n=int(input()) OK=10**18 NG=0 while OK>NG+1: mid=(OK+NG)//2 #print(mid,calc(mid)) if calc(mid)>=n: OK=mid else: NG=mid print(OK)