using System;
class Program
{
const long MOD = 1000000007;
static int CountDivisors(long n)
{
int count = 0;
for (long i = 1; i * i <= n; i++)
{
if (n % i == 0)
{
if (i == n / i)
count++;
else
count += 2;
}
}
return count;
}
static long Power(long x, long y, long mod)
{
long result = 1;
x = x % mod;
while (y > 0)
{
if (y % 2 == 1)
result = (result * x) % mod;
x = (x * x) % mod;
y /= 2;
}
return result;
}
static long ProductOfDivisors(long n)
{
int d = CountDivisors(n);
long sqrtN = (long)Math.Sqrt(n);
if (d % 2 == 0)
return Power(n, d / 2, MOD);
else
return (Power(n, d / 2, MOD) * sqrtN) % MOD;
}
static void Main(string[] args)
{
int t = int.Parse(Console.ReadLine());
for (int i = 0; i < t; i++)
{
long n = long.Parse(Console.ReadLine());
Console.WriteLine(ProductOfDivisors(n));
}
}
}
dXNpbmcgU3lzdGVtOwoKY2xhc3MgUHJvZ3JhbQp7CiAgICBjb25zdCBsb25nIE1PRCA9IDEwMDAwMDAwMDc7CgogICAgc3RhdGljIGludCBDb3VudERpdmlzb3JzKGxvbmcgbikKICAgIHsKICAgICAgICBpbnQgY291bnQgPSAwOwogICAgICAgIGZvciAobG9uZyBpID0gMTsgaSAqIGkgPD0gbjsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKG4gJSBpID09IDApCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmIChpID09IG4gLyBpKQogICAgICAgICAgICAgICAgICAgIGNvdW50Kys7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgY291bnQgKz0gMjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gY291bnQ7CiAgICB9CgogICAgc3RhdGljIGxvbmcgUG93ZXIobG9uZyB4LCBsb25nIHksIGxvbmcgbW9kKQogICAgewogICAgICAgIGxvbmcgcmVzdWx0ID0gMTsKICAgICAgICB4ID0geCAlIG1vZDsKICAgICAgICB3aGlsZSAoeSA+IDApCiAgICAgICAgewogICAgICAgICAgICBpZiAoeSAlIDIgPT0gMSkKICAgICAgICAgICAgICAgIHJlc3VsdCA9IChyZXN1bHQgKiB4KSAlIG1vZDsKICAgICAgICAgICAgeCA9ICh4ICogeCkgJSBtb2Q7CiAgICAgICAgICAgIHkgLz0gMjsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgIH0KCiAgICBzdGF0aWMgbG9uZyBQcm9kdWN0T2ZEaXZpc29ycyhsb25nIG4pCiAgICB7CiAgICAgICAgaW50IGQgPSBDb3VudERpdmlzb3JzKG4pOwogICAgICAgIGxvbmcgc3FydE4gPSAobG9uZylNYXRoLlNxcnQobik7CiAgICAgICAgaWYgKGQgJSAyID09IDApCiAgICAgICAgICAgIHJldHVybiBQb3dlcihuLCBkIC8gMiwgTU9EKTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiAoUG93ZXIobiwgZCAvIDIsIE1PRCkgKiBzcXJ0TikgJSBNT0Q7CiAgICB9CgogICAgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQogICAgewogICAgICAgIGludCB0ID0gaW50LlBhcnNlKENvbnNvbGUuUmVhZExpbmUoKSk7CiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0OyBpKyspCiAgICAgICAgewogICAgICAgICAgICBsb25nIG4gPSBsb25nLlBhcnNlKENvbnNvbGUuUmVhZExpbmUoKSk7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKFByb2R1Y3RPZkRpdmlzb3JzKG4pKTsKICAgICAgICB9CiAgICB9Cn0=