cricket-match

Our Institute , IIIT Jabalpur is going to organize its sport festival, GUSTO.
In that , cricket is organized between teams. But there are several
rules which must be followed in order to form teams.

Rules are

1 - Team should have at least one player in it.

2 - Two persons who are friends cannot be in same team.

We are given the total number of players N , who are numbered from 1 to N.
An integer M is also given which denotes the number of pair of players who are friends.

A pair is of the form "a b"  which denotes that "a" and "b" are friends.

We have to find whether it is possible to form exactly TWO teams, such that each player plays only in one team.

Input:

An integer "t" , denoting the number of test cases.
First line of each test has two integers "N" and "M".
Then M lines follow, each of which contains two integer "a" and "b", separated by a space.

Output:

Print "YES" if it is possible to form two teams , otherwise "NO".

Constraints:

  1 ≤ t ≤ 20
  2 ≤ N ≤ 10^5
  0 ≤ M ≤ 10^4
  1 ≤ a,b ≤ N

SAMPLE INPUT
1
5 3
1 2
2 3
3 4

SAMPLE OUTPUT
YES

Explanation

In the sample testcase,
there are 5 players, and there are 3 pair of friends defined, such that
1 is friend of 2
2 is friend of 3
3 is friend of 4
So, 1 and 2 cannot be in same team, 2 and 3 cannot be in same team and similarly for 3 and 4.
So {1, 3} and {2, 4} should form 2 different teams and 5 can be with either of them.

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: