def solve(X): L=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71] for y in L: if X%y!=0: return y*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)))