#include #include #include #include using namespace std; using lli = long long int; int main(){ lli t; cin >> t; for(int i = 0; i < t; i++) { lli x; cin >> x; lli cnt = 0; lli ans = 1e9; for(lli j = 2; j <= 35; j++) { if(x%j != 0){ ans = min(ans, j); } } vector d(11); d[0] = 2, d[1] = 3, d[2] = 5, d[3] = 7, d[4] = 11, d[5] = 13, d[6] = 17, d[7] = 19, d[8] = 23, d[9] = 29, d[10] = 31; for(int j = 0; j < d.size(); j++) { lli tmp = x, c = d[j]; while(tmp%d[j] == 0){ tmp /= d[j]; c *= d[j]; } if(c > d[j]) ans = min(ans, c); } cout << ans*x << endl; } }