t = int(input()) primes = set(range(2, 60)) for i in [4, 8, 16, 32, 9, 27, 25, 36, 49]: primes.remove(i) primes = sorted(primes) memo = {} def mpow(p, y): tmp = f"{p}-{y}" if tmp in memo: return memo[tmp] memo[tmp] = pow(p, y) return memo[tmp] def cnt(x): ret = 0 for p in primes: y = int(x ** (1 / p)) y -= 2 while mpow(p, y) <= x: y += 1 ret += max(0, y - 2) return ret for _ in range(t): k = int(input()) if k == 1: print(1) continue k -= 1 l = 0 r = (k + 1) ** 2 while r - l > 1: mid = (r + l) // 2 if cnt(mid) >= k: r = mid else: l = mid print(r)