The first line of the input contains an integer $T(1\leq T\leq 10)$, denoting the number of test cases.
In each test case, there are two integers $n,m(1\leq n,m\leq 80)$ in the first line, denoting the number of unknown numbers and NPCs.
For the next $m$ parts, there are two integers $c_i,k_i(1\leq k_i\leq c_i)$ in the first line, denoting the number of hints the $i$-th NPC has and the limit for the $i$-th NPC.
For the next $c_i$ lines, each line contains three integers $l_j,r_j,w_j(1\leq l_j\leq r_j\leq n,1\leq w_j\leq 10^6)$, describing each hint offered by the $i$-th NPC.
It is guaranteed that $\sum c_i\leq 80$ in each test case.