import math def sieve_of_eratosthenes(n): prime = [True]*(n+1) prime[0] = False prime[1] = False sqrt_n = math.ceil(math.sqrt(n)) for i in range(2, sqrt_n+1): if prime[i]: for j in range(2*i, n+1, i): prime[j] = False return prime p = sieve_of_eratosthenes(50) num = [] for i in range(len(p)): if p[i]: num.append(i) T = int(input()) for i in range(T): N = int(input()) X = N ans = float('inf') for x in num: if X%x!=0: ans = min(ans, x) print(N*ans) break else: cnt = 0 while X%x==0: X //= x cnt += 1 ans = min(ans,pow(x,cnt+1))