문제
Bessie the cow enjoys arts and crafts. In her free time, she has made
Every bracelet was a single closed polygonal chain -- a series of vertices (points) connected sequentially by line segments, where the first and last points are the same (Feel welcome to consult the wikipedia page for more detail: polygonal chain),
No bracelet intersected itself (this corresponds to a "simple" polygonal chain); and
No two bracelets intersected.
Unfortunately, right after Bessie arranged the bracelets in such a careful manner, Farmer John drove by in his tractor, shaking the table and causing the bracelets to shift around and possibly break into multiple (not necessarily closed or simple) polygonal chains! Afterward, Bessie wanted to check whether the three conditions above still held. However, it was dark, so she couldn't see the bracelets anymore.
Fortunately, Bessie had a flashlight. She chose
Can you help Bessie use this information to determine whether it is possible that the bracelets still satisfy all three of the conditions above?
입력
Each input case contains T
sub-cases
The first line of the input contains
The first line of each sub-test case contains two integers
출력
For each sub-test case, print YES if it is possible for the three conditions above to be satisfied. Otherwise, print NO.
예제1
5
1 2
2 1 1
2 1 1
1 3
2 1 1
0
2 1 1
2 1
4 1 2 1 2
4 2
6 1 2 2 3 3 1
6 1 2 4 4 2 1
2 2
4 1 1 2 2
4 2 2 1 1
YES
NO
NO
YES
NO
An example of a feasible bracelet configuration for the first sub-case is:

For the fourth sub-case, a feasible arrangement is the following:

SCORING:
Test case 2 satisfies N=1
.
Test cases 3-5 satisfy N=2
.
Test cases 6-8 satisfy M=1
.
Test cases 9-14 satisfy M=2
.
Test cases 15-20 satisfy no additional constraints.
Problem credits: Richard Qi