using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var mlist = CreateMList(); var t = NN; var ans = new long[t]; for (var u = 0; u < t; ++u) { var k = NN; ans[u] = Multi(k, mlist); } WriteLine(string.Join("\n", ans)); } static List CreateMList() { var mset = new HashSet(); for (var i = 2L; i <= 100000; ++i) { var tmp = i * i; var prev = tmp; while (true) { tmp *= i; if (tmp < prev || tmp % i != 0) break; mset.Add(tmp); prev = tmp; } } foreach (var mi in new List(mset)) { if (Sqrt(mi) > 0) mset.Remove(mi); } var mlist = new List(mset); mlist.Sort(); return mlist; } static long Sqrt(long n) { var sq = (long)Math.Sqrt(n); if (sq * sq == n) return sq; if ((sq + 1) * (sq + 1) == n) return sq + 1; return -1; } static long Multi(int k, List mlist) { var ok = 1_000_000_000_000_000_001; var ng = 0L; while (ok - ng > 1) { var mid = (ok + ng) / 2; if (MaxSqrt(mid) + LowerBound(0, mid + 1, mlist) >= k) ok = mid; else ng = mid; } return ok; } static long MaxSqrt(long n) { var sq = (long)Math.Sqrt(n); if (sq * sq <= n) return sq; return sq - 1; } static int LowerBound(int left, long min, List list) { if (list[left] >= min) return left; var ng = left; var ok = list.Count; while (ok - ng > 1) { var center = (ng + ok) / 2; if (list[center] < min) ng = center; else ok = center; } return ok; } }