Professor Elephant is a master of data structure. Recently, he invented a perfect data structure to maintain information on a tree. He is very proud of this invention, so he prepared this problem for you.
You are given a tree with $$$n$$$ nodes. The tree nodes are numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th node has an integer value $$$w_i$$$.
Initially, $$$w_i=0$$$ for all $$$i\in [1,n]$$$.
Let's denote $$$p(u,v)$$$ as all nodes $$$x$$$ on the shortest path from the $$$u$$$-th node to the $$$v$$$-th node(include $$$u$$$ and $$$v$$$). There will be $$$m$$$ events of $$$7$$$ kinds below:
Please write a program to support these events efficiently.
The first line of the input contains an integer $$$T(1\leq T\leq 5)$$$, denoting the number of test cases.
In each test case, there are two integers $$$n,m(1\leq n\leq 500000,1\leq m\leq 2000)$$$ in the first line, denoting the number of nodes and events.
For the next $$$n-1$$$ lines, each line contains two integers $$$u$$$ and $$$v$$$, denoting a bidirectional edge between vertex $$$u$$$ and $$$v$$$.
For the next $$$m$$$ lines, each line describes an event.
For each query event, print a single line containing an integer, denoting the answer.
1 5 8 5 2 5 1 2 4 2 3 1 4 4 5 3 4 4 1 2 3 1 4 6 3 5 4 2 5 5 1 3 6 5 4 7 1 4 2
0 8 0 0 2
| Name |
|---|


