#二分探索の上限をあらかじめ求めておく lim=[0]*60 for i in range(2,60): lim[i]=int((10**18+10000)**(1/i)) def f(n): cnt=[0]*60 for i in range(59,1,-1): ng,ok=lim[i]+1,0 #floor(n^(1/i)) を二分探索で求める while abs(ok-ng)>1: mid=(ok+ng)//2 if mid**i<=n: ok=mid else: ng=mid ok-=1 #約数包除 cnt[i]=ok-sum(cnt[::i]) return sum(cnt)+1 t=int(input()) for _ in range(t): n=int(input()) ng,ok=10**18+1,0 while abs(ok-ng)>1: mid=(ok+ng)//2 if f(mid)>=n: ng=mid else: ok=mid print(ok+1)