#line 1 "a.cpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* macro */ #define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++) #define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--) #define Rep(i, a, n) for (i64 i = (i64)(a); i< (i64)(n); i++) #define RRep(i, a, n) for (i64 i = ((i64)(n-i64(1))); i>=(i64)(a); i--) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() /* macro end */ /* template */ namespace ebi { #ifdef LOCAL #define debug(...) \ std::cerr << "LINE: " << __LINE__ << " [" << #__VA_ARGS__ << "]:", \ debug_out(__VA_ARGS__) #else #define debug(...) #endif void debug_out() { std::cerr << std::endl; } template void debug_out(Head h, Tail... t) { std::cerr << " " << h; if (sizeof...(t) > 0) std::cout << " :"; debug_out(t...); } template std::ostream& operator<<(std::ostream& os, std::pair pa) { return os << pa.first << " " << pa.second; } template std::ostream& operator<<(std::ostream& os, std::vector vec) { for (std::size_t i = 0; i < vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : " "); return os; } using size_t = std::size_t; using i64 = long long; using u64 = unsigned long long; template void fill(std::vector &v) { for(T &e: v) std::cin >> e; } template inline bool chmin(T &a, T b) { if (a > b){ a = b; return true; } return false; } template inline bool chmax(T &a, T b) { if (a < b){ a = b; return true; } return false; } template T gcd(T a, T b){ if( b==0 ) return a; else return gcd(b, a%b); } template T lcm(T a, T b) { return (a*b)/gcd(a,b); } template T Pow(T x, i64 n) { T res = 1; while(n>0){ if(n&1) res = res *x; x = x*x; n>>=1; } return res; } template T scan() { T val; std::cin >> val; return val; } constexpr i64 LNF = std::numeric_limits::max()/4; constexpr int INF = std::numeric_limits::max()/4; const long double PI = acos(-1); const std::vector dy = {1,0,-1,0,1,1,-1,-1}; const std::vector dx = {0,1,0,-1,1,-1,1,-1}; } /* template end */ #line 2 "math/eratosthenes_sieve.hpp" #line 4 "math/eratosthenes_sieve.hpp" /* reference: https://37zigen.com/sieve-eratosthenes/ */ namespace ebi { struct eratosthenes_sieve { private: using i64 = std::int_fast64_t; int n; std::vector table; public: eratosthenes_sieve(int n) : n(n), table(std::vector(n+1, true)) { table[1] = false; for(i64 i = 2; i*i<=n; i++) { if(!table[i]) continue; for(i64 j = i; i*j <= n; j++) { table[i*j] = false; } } } bool is_prime(int p) { return table[p]; } std::vector prime_table(int m = -1) { if(m < 0) m = n; std::vector prime; for(int i = 2; i<=m; i++) { if(table[i]) prime.emplace_back(i); } return prime; } }; } #line 135 "a.cpp" namespace ebi { using ld = long double; using P = std::pair; std::vector table; void main_() { i64 x; std::cin >> x; i64 y = x; i64 ans = LNF; for(i64 p : table) { if(x % p != 0) { chmin(ans, p); break; } int ret = 0; while(x % p == 0) { ret++; x /= p; } int c = ret + 1; if(c > 6) continue; chmin(ans, Pow(p, c)); } std::cout << ans*y << std::endl; } } int main() { std::cout << std::fixed << std::setprecision(15); std::cin.tie(nullptr); std::ios::sync_with_stdio(false); ebi::eratosthenes_sieve sieve(50); ebi::table = sieve.prime_table(); int t; std::cin >> t; while(t--) { ebi::main_(); } return 0; }