def get(x): k = 1 for p in ps: c = 1 while x%p==0: x //= p c += 1 k *= c return k ps = [2,3,5,7,11,13,17,19,23,29,31,37] t,*a = map(int,open(0).read().split()) for x in a: k = get(x) for r in range(2,40): if get(x*r) == 2*k: print(x*r) break