Задачи
I Know the Winner
I Know the Winner
Contest is beginning! After several hours, one of you will be the winner of this contest, and believe it or not, I know who it is!
But of course, I couldn‟t publish his name now, so let's consider another interesting knockout match first. In each round of this match, we choose two players who haven't been sifted out to have a match, the loser will be knocked out until exactly only one person left, and he is the winner.
As the host, No.1 is my friend's ID, I want him win the match, and what‟s more, I can arrange every round of this match, and I also get some information details: Ai always beats Bi. But too many information make me confused. Now I just want to know one thing, can I set the tournament up so that my friend is the winner definitely?
\InputFile
The first line contains a single integer \textbf{T}, indicating the number of test cases. Each test case begins with two integer \textbf{N}(\textbf{1} ≤ \textbf{N} ≤ \textbf{10000}), indicating the number of contestants and \textbf{M} (\textbf{0} ≤ \textbf{M} ≤ \textbf{10000}), indicating the number of information I get. Then \textbf{M} lines follow, each line contains two integers \textbf{A_i} and \textbf{B_i} (\textbf{1} ≤ \textbf{A_i}, \textbf{B_i} ≤ \textbf{N}), indicating \textbf{A_i} will always beats \textbf{B_i}.
\OutputFile
For each test case, if I can make it, output "\textbf{Yes}", otherwise output "\textbf{No}".
Входные данные #1
2 2 1 2 1 3 3 3 1 1 2 2 3
Выходные данные #1
No Yes