li
In this game, a level consists of several worlds. Each world consists of m nodes and some directed roads. The pla
li
li
Each test contains multiple test cases. The first line contains the number of test cases T(1≤T≤30). Desc
The first line contains three integers n,m,k(1≤n≤5×103,2≤m≤20,1≤k≤109).
The following input describes the worlds from 1 to n. For each world:
The first line contains an integer l (0≤l≤m×(m−1)), which is the number of roads in this world.
The next ll lines, each line contains two integers u,v (1≤u,v≤m,u!=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×106.
2
3 3 1
1
2 1
1
2 3
1
1 2
3 3 1
1
1 2
1
1 2
1
2 3
3
2