| Theforces Round #34 (ABC-Forces) |
|---|
| Finished |
You are given a tree of size $$$n$$$ rooted at node $$$1$$$. At first, values of all nodes are equal to $$$0$$$.
Process $$$q$$$ queries of four types:
The first line contains two space-separated integers $$$n$$$ and $$$q$$$ $$$(2 \leq n,q \leq 3 \cdot 10^5)$$$, representing the number of nodes in the tree.
The following $$$n-1$$$ lines describe the edges of the tree. Each line contains two space-separated integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$), indicating an edge between nodes $$$u_i$$$ and $$$v_i$$$. It is guaranteed that the input data represents a tree.
The next $$$q$$$ lines describe the operations:
For each query of type $$$3$$$ or $$$4$$$, output the corresponding maximum value. Each result should be on a new line.
5 101 21 32 42 53 11 1 11 2 22 1 -53 24 13 12 2 -34 13 1
0 3 -2 3 -2 1
| Name |
|---|


