import math def bi(b, x): #y ** b <= x となる最大のyを求める ok = 1 ng = 10 ** 9 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if mid ** b <= x: ok = mid else: ng = mid return ok - 1 def check(x, k): #x以下の累乗数はk個以下であるか? cnt = [0] * 100 for i in range(2, 100): cnt[i] += bi(i, x) for j in range(2 * i, 100, i): cnt[j] = cnt[j] - cnt[i] s = 1 for i in range(100): if 2 ** i > x: break if cnt[i] > 0: s += cnt[i] if s <= k: return True else: return False def solve(): k = int(input()) k -= 1 ok = 10 ** 20 ng = 0 while abs(ng - ok) > 1: mid = (ok + ng) // 2 if check(mid, k): ng = mid else: ok = mid print(ok) t = int(input()) for _ in range(t): solve()