Rhason Cheung had a simple problem, and asked Teacher Mai for help. But Teacher Mai thought this problem was too simple, sometimes naive. So she ask you for help.
Teacher Mai has $m$ functions $f_1,f_2,\cdots,f_m:\{1,2,\cdots,n\}\to\{1,2,\cdots,n\}$(that means for all $x \in \{1,2,\cdots,n\},f(x)\in \{1,2,\cdots,n\}$). But Rhason only knows some of these functions, and others are unknown.
She wants to know how many different function series $f_1,f_2,\cdots,f_m$ there are that for every $i(1\leq i\leq n)$,$f_1(f_2(\cdots f_m(i)))=i$. Two function series $f_1,f_2,\cdots,f_m$ and $g_1,g_2,\cdots,g_m$ are considered different if and only if there exist $i(1\leq i\leq m),j(1\leq j\leq n)$,$f_i(j)\neq g_i(j)$.