def solve(X): L=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71] K=10**18 for y in L: t=0 x=X while x%y==0: t+=1 x//=y if K>y**(t+1): K=y**(t+1) return K*X import sys input=sys.stdin.readline write=sys.stdout.write T=int(input()) Ans=[] for _ in range(T): X=int(input()) Ans.append(solve(X)) write("\n".join(map(str,Ans)))