import sys input = sys.stdin.readline class sieve: def __init__(self, n): self.n = n self.sv = [1] * (n + 1) self.sv[0] = 0 self.sv[1] = 0 self.minp = [n] * (n + 1) for i in range(2, n + 1): if self.sv[i]: self.minp[i] = i for j in range(i * 2, n + 1, i): self.sv[j] = 0 self.minp[j] = min(self.minp[j], i) def isprime(self, x): if x > self.n: return False return self.sv[x] == 1 def factorize(self, x): if self.sv[x]: return [(x, 1)] res = [] while x > 1: p = self.minp[x] c = 0 while x % p == 0: x //= p c += 1 res.append((p, c)) return res def modlcm(self, a, mod): res = [0] * (self.n + 1) ex = set() for i in range(len(a)): f = self.factorize(a[i]) for j in f: if j > self.n: ex.add(j) continue res[j] = max(f.count(j), res[j]) rres = 1 for i in range(self.n + 1): if res[i] != 0: rres *= pow(i, res[i], mod) rres %= mod for i in ex: rres *= i rres %= mod return rres sv = sieve(10 ** 2) primes = [] for x in range(10 ** 2): if sv.isprime(x): primes.append(x) for _ in range(int(input())): x = int(input()) res = 10 ** 20 for p in primes: if x % p: res = min(res, x * p) else: t = x c = 0 while t % p == 0: t //= p c += 1 res = min(res, x * p ** (c + 1)) print(res)