{"raw_statement":[{"iden":"problem statement","content":"Given are an integer $N$ and $M$ pairs of integers. The $i$\\-th pair is $(L_i,R_i)$.\nFind the number of integer sequences $x=(x_1,x_2,\\cdots,x_M)$ that can be generated as follows, modulo $998244353$.\n\n*   Provide a permutation $p=(p_1,p_2,\\cdots,p_N)$ of $(1,2,\\cdots,N)$.\n*   For each $i$ ($1 \\leq i \\leq M$), let $x_i$ be the index of the largest element among $p_{L_i},p_{L_i+1},\\cdots,p_{R_i}$. That is, $\\max(p_{L_i},p_{L_i+1},\\cdots,p_{R_i})=p_{x_i}$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 300$\n*   $1 \\leq M \\leq N(N-1)/2$\n*   $1 \\leq L_i < R_i \\leq N$\n*   $(L_i,R_i) \\neq (L_j,R_j)$ ($i \\neq j$)\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$L_1$ $R_1$\n$L_2$ $R_2$\n$\\vdots$\n$L_M$ $R_M$"},{"iden":"sample input 1","content":"3 2\n1 2\n1 3"},{"iden":"sample output 1","content":"4\n\nFor example, for $p=(2,1,3)$, we will have $x=(1,3)$.\nThe four sequences that meet the requirement are $x=(1,1),(1,3),(2,2),(2,3)$."},{"iden":"sample input 2","content":"6 3\n1 2\n3 4\n5 6"},{"iden":"sample output 2","content":"8"},{"iden":"sample input 3","content":"10 10\n8 10\n5 8\n5 7\n2 5\n1 7\n4 5\n5 9\n2 8\n7 8\n3 9"},{"iden":"sample output 3","content":"1060"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}