11807 - EECS_I2P17_FINAL_C   

Description

From  I2P(I)2017_Chen_Final_Practice

Given an undirected graph G, you have to check whether it is a bipartite graph (二分圖) or not.

Input

The first line contains an integer T, representing the number of test cases.

For each test case:

The first line contains two integers nm, representing the number of vertices and the number of edges.

The next m lines contain two integers uv, representing that there is an undirected edge between vertex u and vertex v.

It is guaranteed that:

  • 1 ≤ T ≤ 10
  • 2 ≤ n ≤ 1000
  • n-1 ≤ m ≤ n2
  • 1 ≤ u, v ≤ 1000
  • NO multiple edge
  • NO self cycle
  • the graph is connected

Output

For each graph G, if G is a bipartite graph, please output "Yes", otherwise please output "No".

Sample Input  Download

Sample Output  Download

Tags




Discuss