#include using namespace std; int ps[11] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}; int main() { int T; cin >> T; while (T--) { long long X; cin >> X; if (X % 2) { cout << 2*X << endl; continue; } int mini = 1 << 30; for (int i = 0; i < 11; i++) { long long x = X; int p = ps[i]; int n = 1; while (x % p == 0) { x /= p; n *= p; } mini = min(mini, n*p); } cout << mini*X << endl; } }