{"raw_statement":[{"iden":"problem statement","content":"Given is a rooted tree with $N$ vertices numbered $1$ to $N$. The root is Vertex $1$, and the $i$\\-th edge $(1 \\leq i \\leq N - 1)$ connects Vertex $a_i$ and $b_i$.\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value $0$.\nNow, the following $Q$ operations will be performed:\n\n*   Operation $j$ $(1 \\leq j \\leq Q)$: Increment by $x_j$ the counter on every vertex contained in the subtree rooted at Vertex $p_j$.\n\nFind the value of the counter on each vertex after all operations."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq Q \\leq 2 \\times 10^5$\n*   $1 \\leq a_i < b_i \\leq N$\n*   $1 \\leq p_j \\leq N$\n*   $1 \\leq x_j \\leq 10^4$\n*   The given graph is a tree.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $Q$\n$a_1$ $b_1$\n$:$\n$a_{N-1}$ $b_{N-1}$\n$p_1$ $x_1$\n$:$\n$p_Q$ $x_Q$"},{"iden":"sample input 1","content":"4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1"},{"iden":"sample output 1","content":"100 110 111 110\n\nThe tree in this input is as follows:\n![image](https://img.atcoder.jp/ghi/c771b2231be06af79a9994cbe6867552.png)\nEach operation changes the values of the counters on the vertices as follows:\n\n*   Operation $1$: Increment by $10$ the counter on every vertex contained in the subtree rooted at Vertex $2$, that is, Vertex $2, 3, 4$. The values of the counters on Vertex $1, 2, 3, 4$ are now $0, 10, 10, 10$, respectively.\n*   Operation $2$: Increment by $100$ the counter on every vertex contained in the subtree rooted at Vertex $1$, that is, Vertex $1, 2, 3, 4$. The values of the counters on Vertex $1, 2, 3, 4$ are now $100, 110, 110, 110$, respectively.\n*   Operation $3$: Increment by $1$ the counter on every vertex contained in the subtree rooted at Vertex $3$, that is, Vertex $3$. The values of the counters on Vertex $1, 2, 3, 4$ are now $100, 110, 111, 110$, respectively."},{"iden":"sample input 2","content":"6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10"},{"iden":"sample output 2","content":"20 20 20 20 20 20"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}