prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def solve(): x = int(input()) for i in range(2, 32): if x % i != 0: print(x * i) return a = 1 b = 1 X = x for p in prime: cnt = 0 while X % p == 0: X //= p cnt += 1 b *= cnt + 1 I = i while I % p == 0: I //= p cnt += 1 a *= cnt + 1 if a == 2 * b: print(x * i) return for _ in range(int(input())): solve()