//#define _GLIBCXX_DEBUG #include #include #include using namespace std; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using vb = vector; using vvb = vector; using vpi = vector; using vvpi = vector; using vpl = vector; using vvpl = vector; const int inf = 1 << 30; const ll INF = 1LL << 60; #define rep(i,m,n) for (int i = m; i < (int)(n); i++) #define rrep(i,m,n) for (int i = m; i > (int)(n); i--) ll cnt_i(ll x,int i){ ll y = floor(pow(x,1/(long double)(i))); return y-1; } bool f(ll x,ll k){ ll ju = 0; vl cnt(61); rrep(i,60,1){ ll c = cnt_i(x,i); for (int j = 2*i; j <= 60; j += i){ c -= cnt[j]; } cnt[i] = c; ju += c; } if (ju >= k-1) return true; else return false; } void solve(){ ll k; cin >> k; ll ng = 0,ok = 1e18+1; while (ok-ng > 1){ ll mid = (ok+ng)/2; if (f(mid,k)) ok = mid; else ng = mid; } cout << ok << endl; } int main(){ int t; cin >> t; rep(i,0,t){ solve(); } }