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.  Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.  Now, the following Q operations will be performed:    * 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.  Find the value of the counter on each vertex after all operations.
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
v = [[] for _ in range(N + 1)]
ans = [0] * (N + 1)

for i in range(N - 1):
    a, b = map(int, input().split())
    v[a].append(b)
    v[b].append(a)
print(v)

for i in reversed(range(2, N + 1)):
    v[i].sort()
    v[v[i][0]].extend(v[i][1:])

v[1].append(0)

for i in range(Q):
    p, q = map(int, input().split())
    for j in v[p]:
        ans[j] += q
    ans[p] += q

print(' '.join(map(str, ans[1:])))
import sys

readline = sys.stdin.readline
read = sys.stdin.read

N, Q = map(int, readline().split())
graph = [[] for _ in range(N + 1)]
cnt = [0] * (N + 1)

for _ in range(N - 1):
    a, b = map(int, readline().split())
    graph[a].append(b)
    graph[b].append(a)

px = map(int, read().split())
for p, x in zip(*[px] * 2):
    cnt[p] += x

stack = [1]
checked = [False] * (N + 1)
checked[1] = True
while stack:
    V = stack.pop()
    for i in graph[V]:
        if checked[i]:
            continue
        checked[i] = True
        stack.append(i)
        cnt[i] += cnt[V]

print(' '.join(map(str, cnt[1:])))
