//print factorial
#include <iostream>
#include <cstring>
using namespace std;
const int maxn=3000;
int main()
{
int nCases;
cin>>nCases;
for(int i=1;i<=nCases;i++)
{
int fac[maxn];
int j,n;
cin>>n;
memset(fac,0,sizeof(fac));
fac[0]=1;
for(i=2;i<=n;i++)
{
int c=0;
for(j=0;j<maxn;j++)
{
int sum=fac[j]*i+c;
fac[j]=sum%10;
c=sum/10;
}
}
for(j=maxn-1;j>=0;j--)
if(fac[j]) break;
for(i=j;i>=0;i--)
cout<<fac[i];
cout<<endl;
}
return 0;
}