分情况讨论
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
long long N;
scanf("%d",&T);
for(int kase=1;kase<=T;kase++)
{
scanf("%lld",&N);
if(N<=2)
printf("%lld\n",N);
else
{
if(N%2==1)
printf("%lld\n",N*(N-1)*(N-2));
else
{
if(N%3==0)
printf("%lld\n",(N-1)*(N-2)*(N-3));
else
printf("%lld\n",N*(N-1)*(N-3));
}
}
}
return 0;
}