Inverse Line Graph

아직 제출이 없습니다시간 제한7초메모리 제한1024 MB

문제

In the mathematical discipline of graph theory, the line graph of an undirected graph GG is another graph L(G)L(G) that represents the adjacencies between edges of GG. L(G)L(G) is constructed in the following way: for each edge in GG, make a vertex in L(G)L(G); for every two edges in GG that have a vertex in common, make an edge between their corresponding vertices in L(G)L(G). (From Wikipedia)

Example of line graph construction

You have solved many tasks based on the line graphs, but you like line graphs so much that you want to solve one more task!

You are given a simple undirected graph GG with nn vertices and mm edges. Your task is to find another simple undirected graph HH, such that GG is the line graph of HH.

입력

There are multiple test cases. The first line contains a single integer TT (1T31051 \le T \le 3 \cdot 10^5), indicating the number of test cases. The test cases follow, for each test case:

The first line contains two integers nn and mm (1n31051 \le n \le 3 \cdot 10^5, 0m31060 \le m \le 3 \cdot 10^6), indicating the number of the vertices and edges in the graph GG.

Each of the following mm lines contains two integers uu and vv (1u,vn1 \le u,v \le n, uvu \ne v), indicating a bidirectional edge between vertex uu and vertex vv in GG.

It is guaranteed that 1n31051 \le \sum n \le 3 \cdot 10^5 and 0m31060 \le \sum m \le 3 \cdot 10^6, and the given graph does not contain multiple edges or self-loops.

출력

For each test case, if such a graph HH does not exist, output a single line with the word "No".

Otherwise, output a line with the word "Yes", followed by a line containing two integers nn' and mm' indicating the number of vertices and the number of edges of HH (0n1060 \le n' \le 10^6, m=nm' = n).

Each of the following mm' lines must contain two integers uu and vv (1u,vn1 \le u,v \le n', uvu \ne v), indicating a bidirectional edge between vertex uu and vertex vv in HH.

Note that the edges in HH will be numbered 1,2,,m1, 2, \ldots, m' in the order you output them. You need to make sure that the numbering of the edges corresponds to the numbering of the vertices in GG.

If there are multiple possible solutions, you can output any one of them.