//#include #include // cout, endl, cin #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower #include #include using namespace std; //using namespace atcoder; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) typedef long long ll; typedef unsigned long long ull; const ll inf=1e18; using graph = vector > ; using P= pair; using vi=vector; using vvi=vector; using vll=vector; using vvll=vector; using vp=vector

; using vpp=vector; //string T="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //string S="abcdefghijklmnopqrstuvwxyz"; //g++ main.cpp -std=c++14 -I . //cout < bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; } template bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; } const int N=55555; int isprime[N+1]; vi prime; void getPrime(){ rep(i,N+1)isprime[i]=1; isprime[0]=0;isprime[1]=0; for(int i=2; i<=N; i++){ if(isprime[i])prime.push_back(i); for(int j=2*i; j<=N; j+=i){ isprime[j]=0; } } } int main(){cin.tie(0); ios::sync_with_stdio(false); getPrime(); int t; cin >> t; vll anss; rep(test,t){ ll x; cin >> x; ll y=x; ll now=x; ll ans=inf; for(auto u:prime){ if(x%u){chmin(ans,u*1ll);break;} else { int cnt=0; while(now%u==0){ now/=u; cnt++; } chmin(ans,pow_pow(u,cnt+1,inf)); } } ans*=x; anss.push_back(ans); } for(auto u:anss)cout << u << endl; }