Each test contains multiple test cases. The first line contains the number of test cases $T(1 \le T \le 30)$. Description of the test cases follows.
The first line contains three integers $n,m,k$ ($1 \leq n \leq 5 \times 10^3, 2 \leq m \leq 20, 1 \leq k \leq 10^9$).
The following input describes the worlds from $1$ to $n$. For each world:
The first line contains an integer $l$ ($0 \leq l \leq m \times (m-1)$), which is the number of roads in this world.
The next $l$ lines, each line contains two integers $u,v$ ($1 \leq u,v \leq m, u \neq v$), which means there is a road from node $u$ to node $v$ in this world.
For each world, it is guaranteed that there is no duplicate edge.
For each test case, it is guaranteed that the sum of $l$ does not exceed $10^6$.
It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$, and the sum of $l$ over all test cases does not exceed $3 \times 10^6$.