#include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; class Eratosthenes{ public: int m; vector is_prime; vector primes; Eratosthenes(int m_){ m = m_; init(); } private: void init(){ is_prime.assign(m+1, true); is_prime[0] = false, is_prime[1] = false; for(int i = 2; i <= m; i++){ if(is_prime[i]){ primes.push_back(i); for(int j = 2; i*j <= m; j++) is_prime[i*j] = false; } } } }; const ll INF = 2e18; ll pow(ll x, int n){ ll ans = 1; for(int i = 0; i < n; i++){ if(INF/x < ans) return INF; ans *= x; } return ans; } ll root_floor(ll n, ll k){ if(n == 1) return 1; if(k == 1) return n; ll l = 1, r = n; while(r-l > 1){ ll x = (l+r)/2; if(pow(x, k) > n) r = x; else l = x; } return l; } const int N_MAX = 1000000; bool used[N_MAX+1]; set st; vector v; void init(){ for(ll i = 2; i <= N_MAX; i++){ ll cur = (ll)i*(ll)i*(ll)i; for(int j = 3; ; j++){ st.insert(cur); if(cur > INF/i) break; cur *= i; } } for(ll x: st){ ll sq = sqrt(x)+0.5; if(sq*sq > x) sq--; if(sq*sq != x){ v.push_back(x); } } } ll count(ll k){ ll sq = sqrt(k)+0.5; if(sq*sq > k) sq--; auto p = upper_bound(v.begin(), v.end(), k); ll ans = sq+(p-v.begin()); return ans; } ll solve(ll k){ if(k == 1) return 1; ll l = 1, r = 1e18; while(r-l > 1){ ll x = (l+r)/2; if(count(x) >= k) r = x; else l = x; } return r; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; init(); int t; cin >> t; while(t--) { ll k; cin >> k; cout << solve(k) << endl; } }