| OCPC 2024 Winter, Day 8: Borys Minaiev Contest 1 (The 3rd Universal Cup. Stage 27: London) |
|---|
| Закончено |
You are given a tree consisting of $$$n$$$ nodes. Initially, node $$$i$$$ has the integer $$$i$$$ written on it. You need to process $$$q$$$ queries of two types:
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) — the number of vertices and queries.
Each of the next $$$n - 1$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$) — edges of the tree.
Each of the next $$$q$$$ lines contains queries in the format "+ a v x" ($$$1 \le a, v \le n$$$, $$$1 \le x \le 10^4$$$) or "? a v" ($$$1 \le a, v \le n$$$).
For each query of the second type, print the answer in a separate line.
5 6 1 2 1 3 3 4 3 5 ? 2 5 + 1 4 1 ? 2 5 + 4 5 2 ? 4 5 ? 1 1
5 1 6 2
| Название |
|---|


