M = 65 for _ in range(int(input())): k = int(input()) if k == 1: print(1) continue k -= 1 l = 1 r = 10**18 while r - l > 1: cnt = 0 m = (l + r) // 2 C = [0] * (M + 1) for i in range(M, 1, -1): c = int(m ** (1 / i)) while pow(c, i) <= m: c += 1 while pow(c, i) > m: c -= 1 c -= 1 C[i] = c for j in range(i + 1, M + 1): if j % i == 0: C[i] -= C[j] cnt += C[i] if cnt >= k: r = m else: l = m print(r)