There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:
The first line contains two integers $N$ and $M$ denoting the number of cities and the number of roads in the President’s plan.
Then $M$ lines follow, each containing two integers $u$ and $v$ representing a one-way road from $u$ to $v$.
1 ≤ $T$ ≤ 20
1 ≤ $N$ ≤ 2 * $10^{4}$
1 ≤ $M$ ≤ $10^{5}$
1 ≤ $u$, $v$ ≤ $N$
The given graph is acyclic, and there are neither multiple edges nor self loops.