import math t = int(input()) cs = [int(input()) for i in range(t)] def sieve_of_eratosthenes(n): prime = [True for i in range(n+1)] prime[0] = False prime[1] = False sqrt_n = math.ceil(math.sqrt(n)) for i in range(2, sqrt_n): if prime[i]: for j in range(2*i, n+1, i): prime[j] = False return prime ss = sieve_of_eratosthenes(61) for i in range(t): k = cs[i] wa = 0#敢えて-1している(ダメな方) ac = 10**18#OKな方 while wa+1 < ac: tmp = 0 mid = (wa + ac) //2 #判定書く for j in range(2,61): if ss[j] == True: #kb = make_divisors(j) #kb = kb % 2 + 2*((kb-2)//2) val = int(mid**(1/j)) plus = (val+1)**j if plus <= mid: tmp += val #tmp -= (val)*kb else: tmp += val-1 #tmp -= (val-1)*kb #print(val,tmp,j,kb) #print(tmp) #exit() if tmp >= k-1: ac = mid else: wa = mid #print(mid,tmp) print(ac)