using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
int t = Convert.ToInt32(Console.ReadLine());
for(int a0 = 0; a0 < t; a0++){
int n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(TripletOn(n));
}
}
static double Triplet(int n)
{
double max=0;
if(n<=0) return -1;
for(double i=1; i<n/3; i++)
{
for(double j=i+1; j<n; j++)
{
var c2 = i*i +j*j;
var c = Math.Pow(c2,.5);
if(i+j+c==Convert.ToDouble(n))
{
var z =i*j*c;
if(z>max)
{
max=z;
}
}
}
}
return max>0 ? max:-1;
}
static long TripletOn(int n)
{
long product = -1;
for(int a = 1; a <= n / 3; a++)
{
int b = (n * n - 2 * n * a)/(2 * n - 2 * a);
int c = n - a - b;
if(a * a + b * b == c * c)
{
if(a * b * c > product)
product = a * b * c;
}
}
return product;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLklPOwp1c2luZyBTeXN0ZW0uTGlucTsKY2xhc3MgU29sdXRpb24gewoKICAgIHN0YXRpYyB2b2lkIE1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIGludCB0ID0gQ29udmVydC5Ub0ludDMyKENvbnNvbGUuUmVhZExpbmUoKSk7CiAgICAgICAgZm9yKGludCBhMCA9IDA7IGEwIDwgdDsgYTArKyl7CiAgICAgICAgICAgIGludCBuID0gQ29udmVydC5Ub0ludDMyKENvbnNvbGUuUmVhZExpbmUoKSk7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKFRyaXBsZXRPbihuKSk7CiAgICAgICAgICAgIAogICAgICAgIH0KICAgIH0KICAgIHN0YXRpYyBkb3VibGUgVHJpcGxldChpbnQgbikKICAgIHsKICAgICAgICBkb3VibGUgbWF4PTA7CiAgICAgICAgaWYobjw9MCkgcmV0dXJuIC0xOwogICAgICAgIGZvcihkb3VibGUgaT0xOyBpPG4vMzsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgZm9yKGRvdWJsZSBqPWkrMTsgajxuOyBqKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHZhciBjMiA9IGkqaSAraipqOwogICAgICAgICAgICAgICAgdmFyIGMgPSBNYXRoLlBvdyhjMiwuNSk7CiAgICAgICAgICAgICAgICBpZihpK2orYz09Q29udmVydC5Ub0RvdWJsZShuKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgeiA9aSpqKmM7CiAgICAgICAgICAgICAgICAgICAgaWYoej5tYXgpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBtYXg9ejsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG1heD4wID8gbWF4Oi0xOwogICAgfQogICAgc3RhdGljIGxvbmcgVHJpcGxldE9uKGludCBuKQogICAgewogICAgICAgIGxvbmcgcHJvZHVjdCA9IC0xOwogICAgICAgIGZvcihpbnQgYSA9IDE7IGEgPD0gbiAvIDM7IGErKykKICAgICAgICB7CiAgICAgICAgICAgIGludCBiID0gKG4gKiBuIC0gMiAqIG4gKiBhKS8oMiAqIG4gLSAyICogYSk7CiAgICAgICAgICAgIGludCBjID0gbiAtIGEgLSBiOwogICAgICAgICAgICBpZihhICogYSArIGIgKiBiID09IGMgKiBjKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZihhICogYiAqIGMgPiBwcm9kdWN0KSAKICAgICAgICAgICAgICAgICAgICBwcm9kdWN0ID0gYSAqIGIgKiBjOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBwcm9kdWN0OwogICAgfQp9