{"raw_statement":[{"iden":"problem statement","content":"We have a directed graph with $N$ vertices and $M$ edges. The vertices are numbered from $1$ through $N$, and the $i$\\-th edge goes from vertex $U_i$ to vertex $V_i$.\nYou are currently at vertex $1$. Determine if you can make the following move $10^{10^{100}}$ times to end up at vertex $1$:\n\n*   choose an edge going from the vertex you are currently at, and move to the vertex that the edge points at.\n\nGiven $T$ test cases, solve each of them."},{"iden":"constraints","content":"*   All input values are integers.\n*   $1\\leq T \\leq 2\\times 10^5$\n*   $2\\leq N \\leq 2\\times 10^5$\n*   $1\\leq M \\leq 2\\times 10^5$\n*   The sum of $N$ over all test cases is at most $2 \\times 10^5$.\n*   The sum of $M$ over all test cases is at most $2 \\times 10^5$.\n*   $1 \\leq U_i, V_i \\leq N$\n*   $U_i \\neq V_i$\n*   If $i\\neq j$, then $(U_i,V_i) \\neq (U_j,V_j)$."},{"iden":"input","content":"The input is given from Standard Input in the following format. Here, $\\text{test}_i$ denotes the $i$\\-th test case.\n\n$T$\n$\\text{test}_1$\n$\\text{test}_2$\n$\\vdots$\n$\\text{test}_T$\n\nEach test case is given in the following format.\n\n$N$ $M$\n$U_1$ $V_1$\n$U_2$ $V_2$\n$\\vdots$\n$U_M$ $V_M$"},{"iden":"sample input 1","content":"4\n2 2\n1 2\n2 1\n3 3\n1 2\n2 3\n3 1\n7 10\n1 6\n6 3\n1 4\n5 1\n7 1\n4 5\n2 1\n4 7\n2 7\n4 3\n7 11\n1 6\n6 3\n1 4\n5 1\n7 1\n4 5\n2 1\n4 7\n2 7\n4 3\n3 7"},{"iden":"sample output 1","content":"Yes\nNo\nNo\nYes\n\nFor the $1$\\-st test case,\n\n*   You inevitably repeat visiting vertices $1 \\rightarrow 2 \\rightarrow 1 \\rightarrow \\dots$. Thus, you will end up at vertex $1$ after making the move $10^{10^{100}}$ times, so the answer is `Yes`.\n\nFor the $2$\\-nd test case,\n\n*   You inevitably repeat visiting vertices $1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 1 \\rightarrow \\dots$. Thus, you will end up at vertex $2$ after making the move $10^{10^{100}}$ times, so the answer is `No`."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}