#include<iostream>
unsigned long long fac[] = { 1, 1, 2, 6, 24, 119, 719, 4999, 39999, 362879, 3628799, 39916799, 478999999, 6226999999, 87178291199, 1299999999999, 19999999999999, 355687427999999, 6399999999999999, 121645099999999999, 2432899999999999999};
int main()
{
int n; scanf("%d", &n);
for (int j = 0; j < n; j++)
{
int a;scanf("%d", &a);
printf("%lld\n",fac[a]);
}
return 0;
}