#include "bits/stdc++.h" #define int long long using namespace std; using ll = long long; using P = pair; const ll INF = (1LL << 61); ll mod = 1000000007; signed main() { ios::sync_with_stdio(false); cin.tie(0); vector a = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 }; int s = 12; int T; cin >> T; for (int _ = 0; _ < T; _++) { int X; cin >> X; int tmp = X; int ans = INF; for (int i = 0; i < s; i++) { int cnt = 1; while (X % a[i] == 0) { X /= a[i]; cnt++; } int now = 1; for (int j = 0; j < cnt; j++)now *= a[i]; ans = min(ans, now); X = tmp; } X *= ans; cout << X << endl; } return 0; }