micro-and-coins

Micro was playing with a graph gifted to him by his friend on his birthday. The graph contains N vertices and M edges. All the edges are bidirectional. On each vertex of the graph there is a coin. Now Micro has to collect them all. But the game has some rules. The player has to start with some vertex. From current vertex, player can visit only those vertices which are connected to it by an edge. Also if a vertex is visited it cannot be visited again. Now Micro wants to find if he'll be able to collect all the coins.

Input:
First line consists of an integer T denoting the number of test cases.
First line of each test case consists of  two space separated integers denoting N and M and the following M lines consists of two space separated integers X and Y denoting there is an edge between vertices X and Y.

Output:
For each test case, if Micro is able to collect all the coins then print "Yes" (without quotes) otherwise print "No" (without quotes).

Constraints:
 1 ≤ T ≤ 10 
 1 ≤ N ≤ 10 
 0 ≤ M ≤ 100  
 1 ≤ X, Y ≤ N  

SAMPLE INPUT
2
3 3
1 2
2 3
1 3
3 2
1 2
2 1

SAMPLE OUTPUT
Yes
No

Source: hackerearth | Difficulty: EASY
Tags: Graph algorithms


Solutions: