import java.io.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); while(t-->0) { int n=Integer.parseInt(bu.readLine()); long l=1,r=(long)1e18,mid,ans=r; while(l<=r) { mid=(l+r)>>1; if(count(mid)>=n) { ans=mid; r=mid-1; } else l=mid+1; } sb.append(ans+"\n"); } System.out.print(sb); } static long c[]=new long[61]; static int ex[]={0,0,1000000001,1000001,31623,3982,1001,373,178,101,64,44,32,25,20,16,14,12,11,9,8,8,7,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2}; static long count(long n) { int i,N=60; for(i=2;i<=N;i++) { int l=2,r=ex[i],mid,ans=0; long v; while(l<=r) { mid=(l+r)>>1; v=power(mid,i,n); if(v<=n) { ans=mid-1; l=mid+1; } else r=mid-1; } c[i]=ans; } int j; long ans=1; for(i=N;i>1;i--) { //System.out.print(c[i]+" "); for(j=2*i;j<=N;j+=i) c[i]-=c[j]; ans+=c[i]; } //System.out.println(n+" "+ans); return ans; } static long power(long a,int b,long n) { if(a>n) return n+1; long res=1; while(b!=0) { if(res>n/a) return n+1; res=res*a; b--; if(res>n) return n+1; } return res; } }