# Xを素因数分解 # 既存素因数のべき乗を倍にするか、ない素因数を加える # 10**11ということは37までに存在しない素因数があるはず # 2*3*5*7*11*13*17*19*23*29*31*37 = 7*10**12 # 必要なのは37までの素因数だけ # WAだった、2の乗数と3の乗数が両方増えるというパターンがある # 素因数で考えると、そのコンビネーションもあるから難しい # 発想の転換、multiplierは37までのどれかの数字にあると考えればいい # 37超の素因数は無視する # TLEしたので、素因数のべき乗数のリストをコピーして使う primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41] def low_prime_div_count(num): count = [0]*13 div_count = 1 for i in range(13): p = primes[i] c = 0 while num%p == 0: num //= p c += 1 count[i] = c div_count *= (c+1) return div_count, count T = int(input()) for t in range(T): X = int(input()) base, count = low_prime_div_count(X) #print('base', base, 'count', count) for n in range(2, 38): temp_count = count.copy() div_temp = 1 n_ = n for i in range(13): p = primes[i] c = 0 while n_%p == 0: n_ //= p c += 1 temp_count[i] += c div_temp *= (temp_count[i]+1) #print('n', n, 'temp_count', temp_count, 'div_temp', div_temp) if div_temp == base*2: print(X*n) break