For a permutation p=p\[0]p\[1]p\[2]…p\[n−1] of the numbers 1,2,3,…,n we define a split as a permutation q which can be obtained by the following process:
- Select two sets of numbers A=i_1,i_2,…,i_k and B=j_1,j_2,…,j_l such that A∩B=∅, A∪B=0,1,2,…,n−1, i_1<i_2<⋯<i_k and j_1<j_2<⋯<j_l.
- The permutation q will be q=p\[i_1]p\[i_2]…p\[i_k]p\[j_1]p\[j_2]…p\[j_l]
Moreover, we define S(p) to be the set of all splits of a permutation p.
You are given a number n and a set T of m permutations of length n. Count how many permutations p of length n exist such that T⊆S(p). Since this number can be large, find it modulo 998,244,353.