#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} const ll LIM=1000000000000000000LL; int main(){ vector other; for(ll a=2;a<=1000001;a++){ ll add=a*a; rep(_,0,65){ if(add>=LIM/a)break; add*=a; { ll sq=sqrt(add); rep(off,-5,5)if(ll(sq+off)*(sq+off)==add)goto fail; other.push_back(add); fail:; } } } sort(ALL(other)); int q; cin>>q; while (q--) { int x; cin>>x; x--; ll lb=0,rb=LIM+5; while(rb-lb>1){ ll mid=(lb+rb)>>1; ll cnt=upper_bound(ALL(other),mid)-other.begin(); ll sub=sqrt(mid),add; rep(off,-5,5)if(ll(sub+off)*(sub+off)<=mid)add=sub+off; cnt+=add; if(cnt>x)rb=mid; else lb=mid; } cout<