import sys input = lambda: sys.stdin.readline().rstrip() def get_primelist(n: int) -> list: # eratosthenes,O(NloglogN) if n == 1: return [] ret = list(range(2, n+1)) p = [] while ret[0]**2 <= n: tmp = ret[0] p.append(tmp) ret = [e for e in ret if e%tmp != 0] return p + ret # ----------------------- # prime = get_primelist(10**6) def main(): n = int(input()) for p in prime: if n % p != 0: return n * p print('\n'.join(str(main()) for _ in range(int(input()))))