Keep It Cool

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Consider the set of all pairs (a,b)(a, b) with aa and bb satisfying the constraint 1a<bn1 \leq a < b \leq n. A permutations of all these pairs is called balanced if and only if, for any aa, bb and cc satisfying 1a<b<cn1 \leq a < b < c \leq n, the pair (a,c)(a, c) is between the pairs (a,b)(a, b) and (b,c)(b, c) in the permutation. That is, those three pairs appear in the permutation either in the order (a,b),(a,c),(b,c)(a, b), (a, c), (b, c), or in the order (b,c),(a,c),(a,b)(b, c), (a, c), (a, b).

Moreover, there are mm additional restrictions on the permutation, ii-th of them states that the pair (a_i,b_i)(a\_i, b\_i) should appear before the pair (c_i,d_i)(c\_i, d\_i) in the permutation. Compute the number of balanced permutations that satisfy these mm restrictions.

입력

In the first line of the input, there are space-separated integers nn and mm (2n102 \le n \le 10; 0m100 \le m \le 10). The ii-th of the following mm lines contains space-separated integers a_ia\_i, b_ib\_i, c_ic\_i, and d_id\_i (1a_i<b_in1 \le a\_i < b\_i \le n; 1c_i<d_in1 \le c\_i < d\_i \le n; pairs (a_i,b_i)(a\_i, b\_i) and (c_i,d_i)(c\_i, d\_i) are different).

출력

Print the number of balanced permutations where (a_i,b_i)(a\_i, b\_i) appears before (c_i,d_i)(c\_i, d\_i) for every ii. As this number can be very large, print it modulo prime number 998,244,353998\\,244\\,353.

힌트

In the second sample, the permutations are:  (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)(1,2),(1,3),(2,3),(1,4),(2,4),(3,4)(1,2), (1,3), (2,3), (1,4), (2,4), (3,4).