Binary String

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

문제

Rikka has a binary string with nn bits.

We don't know the string. The thing we know for sure is, for each i1,2,,mi \in \\{1, 2, \ldots, m\\}, at least one of the following is true: "there are exactly x_ix\_i ones in the first y_iy\_i bits" or "there are exactly y_iy\_i ones in the last x_ix\_i bits".

Find the number of possible binary strings modulo 998,244,353998\\,244\\,353.

입력

The first line contains an integer TT which denotes the number of test cases (1T51 \leq T \leq 5). 

For each test case, the first line contains two integers nn and mm (1n50001 \leq n \leq 5000, 0m10000 \leq m \leq 1000).

The ii-th of the following mm lines contains two integers x_ix\_i and y_iy\_i (0x_i,y_in0 \leq x\_i, y\_i \leq n, x_i0x\_i \neq 0 or y_i0y\_i \neq 0).

출력

For each test case, print an integer which denotes the number of binary strings satisfying the constraints, modulo 998,244,353998\\,244\\,353.