#include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; vector primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}; vector> vs; void dfs(int prod, int i, vector &v){ if(!v.empty()){ vs.push_back(v); } for(int j = i; j < primes.size(); j++){ if(prod*primes[j] <= 31) { v.push_back(primes[j]); dfs(prod*primes[j], j, v); v.pop_back(); } } } void init(){ vector v; dfs(1, 0, v); } bool ok(ll x, vector v){ ll y = x; set st; for(int p: v) { y *= p; st.insert(p); } ll a = 1; ll b = 1; for(int p: st){ int cnt_x = 0, cnt_y = 0; while(x%p == 0){ x /= p; cnt_x++; } while(y%p == 0){ y /= p; cnt_y++; } a *= cnt_x+1; b *= cnt_y+1; } return a*2 == b; } void solve(){ ll x; cin >> x; int ans = 100; for(auto v: vs){ if(ok(x, v)){ int prod = accumulate(v.begin(), v.end(), 1, [](int a, int b){ return a*b; }); chmin(ans, prod); } } cout << ans*x << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; init(); int t; cin >> t; while(t--) solve(); }