# 指定した整数以下の素数を列挙。エラトステネスの篩 def eratosthenes(n): l0=list(range(2,n+1)) l1=[1]*(n+1) l1[0]=0 l1[1]=0 for li in l0: if li>int(n**0.5): break if l1[li]==1: k=2 while k*li<=n: l1[k*li]=0 k+=1 ret=[i for i,li in enumerate(l1) if li==1] return ret # 素因数分解 def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr.append([n, 1]) return arr prime=eratosthenes(32) prime.sort() t=int(input()) xx=[int(input()) for _ in range(t)] inf=float('inf') for x in xx: ary=factorization(x) ps={p:q for p,q in ary} # pow(p,ps[p]+1) ans=inf for p in prime: if p in ps: ans=min(ans,x*pow(p,ps[p]+1)) else: ans=min(ans,x*p) print(ans)