#The solution in Python 3 is as follows:
t = int(input())
i=0
while i<t:
a=int(input())
j=1
fact=1
while j<=a:
fact=fact*j #you can also use factorial() function from math
j+=1
print(fact)
i+=1
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!
t = int(input())
i=0
while i<t:
a=int(input())
j=1
fact=1
while j<=a:
fact=fact*j #you can also use factorial() function from math
j+=1
print(fact)
i+=1
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!