#include<bits/stdc++.h> using namespace std; #define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' //#define vec vector<ll> //#define mat vector<vector<ll> > #define fi first #define se second #define double long double typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> pll; //typedef long double ld; typedef complex<double> Complex; const ll INF=1e9+7; const ll MOD=998244353; const ll inf=INF*INF; const ll mod=INF; const ll MAX=1000010; const double PI=acos(-1.0); typedef vector<vector<ll> > mat; typedef vector<ll> vec; signed main(){ ll t; cin>>t; vector<ll>p(MAX); vector<ll>a(0); REP(i,2,MAX/2){ ll k=1; if(p[i]>0)continue; a.pb(i); while(k*i<MAX){ if(p[k*i]==0)p[k*i]=i; k++; } } while(t--){ ll x;cin>>x; REP(i,2,100){ ll z=i; ll y=x; ll cn=1; ll cnt=1; while(z>1){ ll b=p[z]; ll s=1; while(z%b==0){ s++; z/=b; } ll ss=1; while(y%b==0){ ss++; s++; y/=b; } cnt*=ss; cn*=s; } if(cnt*2==cn){ cout<<x*i<<endl; break; } } } }