import math def fac(x): L=int(math.sqrt(x)) FACT=dict() for i in range(2,L+2): while x%i==0: FACT[i]=FACT.get(i,0)+1 x=x//i if x!=1: FACT[x]=FACT.get(x,0)+1 return FACT F=[[],[]] for i in range(2,1000): F.append(fac(i)) T=int(input()) for tests in range(T): X=int(input()) for i in range(2,1000): Y=X FA=F[i] bunbo=1 bunsi=1 for fa in FA: c=0 while Y%fa==0: Y//=fa c+=1 # c+FA[fa]+1/c+1 bunbo*=c+1 bunsi*=c+FA[fa]+1 if bunbo*2==bunsi: print(X*i) break