from math import isqrt from bisect import bisect_right # 平方数でない累乗数を列挙 MAX = 10 ** 18 power_without_square = set() for b in range(3, 64): a = 2 while True: p = a ** b if p > MAX: break a += 1 if isqrt(p) ** 2 == p: continue power_without_square.add(p) power_without_square = sorted(power_without_square) T=int(input()) for _ in range(T): N=int(input()) # x以下の累乗数がいくつあるか二分探索 l, r = 0, MAX while r - l > 1: m = (l + r) // 2 ct = isqrt(m) + bisect_right(power_without_square, m) if ct >= N: r = m else: l = m print(r)