#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int t; cin>>t; const int mx = 3e5; vector cnt(mx+1,0); vector use; for(int i = 2;i<=mx;i++){ if(cnt[i]) continue; use.push_back(i); for(int j = i;j<=mx;j+=i) cnt[j] = 1; } while(t--){ ll a; cin>>a; ll ans = a * 100; for(auto&e:use){ if(a*e>ans) break; int cnt = 0; ll b = a; while(b%e==0){ b /= e; cnt++; } int m = cnt + 1; int want = 2 * m - 1; ll now = a; for(int i = 0;ians) break; } ans = min(ans,now); } cout<