Little Q is researching an active volcano. There are n caves inside the volcano, labeled by 1,2,…,n. At the very beginning, before the first volcanic activity event, there is no magma path between these caves. You will be given q operations, each operation is one of the following:
The first line contains a single integer T (1≤T≤100), the number of test cases. For each test case:
The first line contains two integers n and q (2≤n≤50,000, 1≤q≤200,000), denoting the number of caves and the number of operations.
Each of the next q lines describes an operation in formats described in the statement above.
It is guaranteed that the sum of all n is at most 300,000, and the sum of all q is at most 1,000,000.
2
3 7
1 1 2 1
2 1 1
1 2 3 5
1 1 3 4
2 2 4
2 2 5
2 2 3
2 4
1 1 2 1
1 1 2 2
2 1 1
2 1 2
NO
YES
YES
NO
YES
YES