#include<stdio.h>
int main()
{
int arr[160]={0},k,n,i,num,j,x,temp,m=0,flag,l;
scanf("%d",&n);
for(k=0;k<n;k++)
{
scanf("%d",&num);
for(i=0;i<160;i++)
arr[i]=0;
arr[0]=1;
m=0;
temp=0;
for(i=2;i<=num;i++)
{
for(j=0;;j++)
{
x=arr[j]*i+temp;
arr[j]=x%10;
temp=x/10;
m=j;
for(l=j;l<j+23;l++)
{
if(arr[l+1]!=0)
flag=1;
}
if(flag!=1)
break;
}
}
for(i=m;i>=0;i--)
printf("%d",arr[i]);
printf("\n");
}
}
I2luY2x1ZGU8c3RkaW8uaD4KaW50IG1haW4oKQp7CiAgaW50IGFyclsxNjBdPXswfSxrLG4saSxudW0saix4LHRlbXAsbT0wLGZsYWcsbDsKICBzY2FuZigiJWQiLCZuKTsKICBmb3Ioaz0wO2s8bjtrKyspCiAgewogICAgIHNjYW5mKCIlZCIsJm51bSk7CiAgICAgZm9yKGk9MDtpPDE2MDtpKyspCiAgICAgYXJyW2ldPTA7CiAgICAgYXJyWzBdPTE7CiAgICAgbT0wOwogICAgIHRlbXA9MDsKICAgICBmb3IoaT0yO2k8PW51bTtpKyspCiAgICAgewogICAgICAgIGZvcihqPTA7O2orKykKICAgICAgICB7CiAgICAgICAgICAgeD1hcnJbal0qaSt0ZW1wOwogICAgICAgICAgIGFycltqXT14JTEwOwogICAgICAgICAgIHRlbXA9eC8xMDsKICAgICAgICAgICBtPWo7CiAgICAgICAgICAgZm9yKGw9ajtsPGorMjM7bCsrKQogICAgICAgICAgIHsKICAgICAgICAgICAgICAgaWYoYXJyW2wrMV0hPTApCiAgICAgICAgICAgICAgIGZsYWc9MTsKICAgICAgICAgICB9CiAgICAgICAgICAgaWYoZmxhZyE9MSkKICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgfQogICAgIGZvcihpPW07aT49MDtpLS0pCiAgICAgcHJpbnRmKCIlZCIsYXJyW2ldKTsKICAgICBwcmludGYoIlxuIik7CiAgfQp9ICAg