The first line contains a single integer (), denoting the number of test cases.
For each test case, the first line contains an integer (). The next line contains integers (), indicating that there is an edge between and for each .
It is guaranteed that the sum of over all test cases is no more than .