primes = [2,3,5,7,11,13,17,19,23,29,31] from collections import defaultdict def f(x): tmp = x yaku1 = 1 dic = defaultdict(int) coordinate = [] for p in primes: cnt = 0 while tmp % p == 0: tmp = tmp//p cnt += 1 dic[p] = cnt yaku1 *= (cnt+1) coordinate.append(p**(cnt+1)) for i in range(2,32): tmp = x * i yaku2 = 1 for p in primes: cnt = 0 while tmp % p == 0: tmp = tmp //p cnt += 1 yaku2 *= (cnt+1) if 2 * yaku1 == yaku2: coordinate.append(i) return min(coordinate) * x T = int(input()) store = [] for _ in range(T): x = int(input()) store.append(x) for x in store: print(f(x))