#define MOD_TYPE 1 #pragma region Macros #include using namespace std; #if 1 #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #endif #if 1 #include #include #include #include using namespace __gnu_pbds; using namespace __gnu_cxx; template using extset = tree, rb_tree_tag, tree_order_statistics_node_update>; #endif #if 0 #include #include using Int = boost::multiprecision::cpp_int; using lld = boost::multiprecision::cpp_dec_float_100; #endif using ll = long long int; using ld = long double; using pii = pair; using pll = pair; using pld = pair; template using smaller_queue = priority_queue, greater>; constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353); constexpr int INF = (int)1e9 + 10; constexpr ll LINF = (ll)4e18; constexpr ld PI = acos(-1.0); constexpr ld EPS = 1e-7; constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0}; constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0}; #define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i) #define rep(i, n) REP(i, 0, n) #define REPI(i, m, n) for (int i = m; i < (int)(n); ++i) #define repi(i, n) REPI(i, 0, n) #define MP make_pair #define MT make_tuple #define YES(n) cout << ((n) ? "YES" : "NO") << "\n" #define Yes(n) cout << ((n) ? "Yes" : "No") << "\n" #define possible(n) cout << ((n) ? "possible" : "impossible") << "\n" #define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n" #define all(v) v.begin(), v.end() #define NP(v) next_permutation(all(v)) #define dbg(x) cerr << #x << ":" << x << "\n"; struct io_init { io_init() { cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(30) << setiosflags(ios::fixed); }; } io_init; template inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } inline ll CEIL(ll a, ll b) { return (a + b - 1) / b; } template inline void Fill(A (&array)[N], const T &val) { fill((T *)array, (T *)(array + N), val); } template constexpr istream &operator>>(istream &is, pair &p) noexcept { is >> p.first >> p.second; return is; } template constexpr ostream &operator<<(ostream &os, pair &p) noexcept { os << p.first << " " << p.second; return os; } #pragma endregion // -------------------------------------- const int MAX_N = 2e5; ll can_div[MAX_N] = {}; void init_prime() { can_div[1] = -1; for (ll i = 2; i < MAX_N; i++) { if (can_div[i] != 0) continue; for (ll j = i + i; j < MAX_N; j += i) can_div[j] = i; } } struct init_prime_ { init_prime_() { init_prime(); }; } init_prime_; inline bool is_prime(ll n) { if (n <= 1) return false; return !can_div[n]; } void factorization(int n, unordered_map &res) { if (n <= 1) return; if (!can_div[n]) { ++res[n]; return; } ++res[can_div[n]]; factorization(n / can_div[n], res); } vector primes; void solve() { ll x; cin >> x; ll ans; ll maxp; for (auto p : primes) { if (x % p != 0) { ans = x * p; maxp = p; break; } } for (ll k = 2; k < maxp; k++) { ll y = x * k; ll a = 1, b = 1; for (auto p : primes) { ll t, cnt; t = x, cnt = 0; while (t % p == 0) { t /= p; cnt++; } a *= cnt + 1; t = y, cnt = 0; while (t % p == 0) { t /= p; cnt++; } b *= cnt + 1; } if (a * 2 == b) { ans = y; break; } } cout << ans << "\n"; } int main() { REP(i, 2, 50) { if (is_prime(i)) primes.push_back(i); } int testcase; cin >> testcase; while (testcase--) solve(); }