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