# 約数の個数は素因数の乗数+1の積 # ということはその数に存在しない素因数倍であれば約数個数は2倍になる # たとえば12であれば2と3は素数なので5倍の60のときに約数個数は2倍になる # 存在しない素因数前に、存在する素因数の乗数+1を2倍にできる場合はそれでもok # たとえば6=2**1*3**1で、4をかければ2**3となり約数個数は2倍になる # 2*3*5*7*11*13*17*19*23*29*31 > 10**11なので、ここまでの素因数で存在しないものがあるはず # 面倒なのは420=2**2*3*5*7, この倍数は6すると2と3の乗数が増えて倍になる # そうであれば31までで全探索した方が早いか, TLEした # 31までの素因数だけで数を調べる、それ以上は調べない、素因数分解もしない # 素因数分解、辞書型 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[i] = cnt if temp!=1: arr[temp] = 1 return arr from collections import defaultdict small_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] div_count_to31 = [{}, {}] for i in range(2, 32): div_count_to31.append(factorization(i)) #print(div_count_to31) T = int(input()) for i in range(T): X = int(input()) X_copy = X X_factors = defaultdict(int) for p in small_primes: while X%p == 0: X_factors[p] += 1 X //= p #print('X_factors', X_factors) count = 1 for key in X_factors.keys(): count *= X_factors[key]+1 for j in range(2, 32): count2 = count for key2 in div_count_to31[j].keys(): count2 //= X_factors[key2]+1 count2 *= X_factors[key2]+div_count_to31[j][key2]+1 #print('X_copy', X_copy, 'j', j, 'count', count, 'count2', count2) if count2 == count*2: print(X_copy*j) break