In hospitals, lines are often drawn on the floor in various directions to help guide visitors to different areas. One day, while Amin was waiting outside the operating room, he started thinking about this:
Suppose there are departments in a hospital connected by corridors, forming a layout that can be represented as an undirected, connected graph with vertices and edges.
Amin wants to color each edge in this graph with one of two colors, red or blue, so that for any two departments (vertices), one can follow a continuous path of edges of same color to travel between them.
This means that if someone wants to travel from department to department , first we could guide them “follow red” or “follow blue”.
The question Amin faces is: can we color edges of the graph in such a way that any two vertices can be reached using a guide like "follow red/blue"?
The first line of input contains an integer representing the number of test cases.
For each test case, the first line contains two positive integers and , representing the number of vertices and edges.
In the next lines, each line contains two integers and , indicating the existence of an edge in the graph.
It is guaranteed that the given graphs are simple and connected.
If there is such coloring print YES
; otherwise print NO
.