1 u v, merge the forest containing the u-th tree and the forest containing the v-th tree;
2 u, separate the u-th tree from its forest;
The first line contains an integer T
, indicating the number of testcases.
In each test case:
The first line contains two integers N and Q
, indicating the number of initial forests and the number of operations.
Then Q lines follow, and each line describes an operation
.
For each test cases, the first line should be "Case #i:", where i indicate the test case i.
For each query 3, print a integer in a single line.
For each query 4, print "YES" or "NO" in a single line.