from collections import defaultdict def prime_factorization(n): prime_cnt_dict = defaultdict(int) if n == 0 or n == 1: return prime_cnt_dict nc = n while nc % 2 == 0: nc //= 2 prime_cnt_dict[2] += 1 f = 3 while f * f <= n: cnt = 0 while nc % f == 0: nc //= f prime_cnt_dict[f] += 1 f += 2 if nc != 1: prime_cnt_dict[nc] = 1 return prime_cnt_dict Prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] PrimeCountList = [prime_factorization(i) for i in range(32)] t = int(input()) for _ in range(t): x = int(input()) x_prime_cnt_dict = defaultdict(int) for prime in Prime: xc = x while xc % prime == 0: xc //= prime x_prime_cnt_dict[prime] += 1 for i in range(2, 32): x_cnt = 1 x_i_cnt = 1 for prime in PrimeCountList[i]: x_cnt *= x_prime_cnt_dict[prime] + 1 x_i_cnt *= x_prime_cnt_dict[prime] + PrimeCountList[i][prime] + 1 if 2 * x_cnt == x_i_cnt: break print(x * i)