You are given a tree with $N$ vertices where the $i^\text{th}$ edge connects vertices $u_i$ and $v_i$. Each edge on this tree is either a light or a heavy edge. Initially, all edges are light.
You should process the following $Q$ operation of $2$ types:
Each test contains multiple test cases. The first line of input contains a single integer $T$, the number of test cases. The description of the test cases follows.
The first line of each test case contains two integer $N$ and $Q$, the size of the tree and the number of operations you need to process.
The following $N-1$ lines of each test case contains two integer $u_i$ and $v_i$, describing the vertices that the $i^\text{th}$ edge connects.
The following $Q$ lines of each test case contains three integers $op_i$, $a_i$ and $b_i$, describing an operation.
For each operation of type $2$, print the answer in a separate line.
1
7 7
1 2
1 3
3 4
3 5
3 6
6 7
1 1 7
2 1 4
2 2 7
1 1 5
2 2 7
1 2 1
2 1 7
1
3
2
1
Subtask | Score |
---|---|
1 | 10 |
2 | 10 |
3 | 20 |
4 | 20 |
5 | 20 |
6 | 20 |
7 | 0 |