The first line contains an integer T, the number of graphs to check. T is at most 10.
Each graph is given in the following format.
The first line contains the number of nodes N, where 1≤N≤1000. The nodes are numbered from 1 to N.
The next line contains the number of edges M, where 0≤M≤106.
The next M lines each contain two integers A and B, the two nodes that one edge connects. A and B can be equal, and the same pair can appear more than once.
The sum of M over all graphs is at most 106.