


The very first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of every test case contains two space-separated integers ‘V’ and ‘E’ denoting the number of vertices and the number of edges present in the graph.
The next ‘E’ lines contain two space-separated integers ‘a’ and ‘b’ denoting a directed edge from vertex ‘a’ to ‘b’.
Use zero-based indexing for the vertices.
For each test case, print space-separated vertices present in the strongly connected components of the graph, print the output for one SCC on each line.
The order of sequence does not matter.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= 'T' <= 300
1 <= 'V' <= 2000
'V' - 1 <= 'E' <= 2000
0 <= 'a, b' < 'V'
Time Limit: 1 sec
The algorithm for the approach is as follows:
Let us understand this by an example: