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.
N, Q = map(int,input().split())
side = []
p = [0] * (Q)
x = [0] * (Q)

for _ in range(N-1):
  s = []
  s = list(map(int, input().split()))
  side.append(s)
for i in range(Q):
  p[i], x[i] = map(int, input().split())

counter = [0] * N
#print(N,Q)
#print(side)
#print(p)
#print(x)

for i in range(Q):
  group = []
  group.append(p[i])
  for s in side:
    if (s[0] in group) == True:
      group.extend(s)
  group = list(set(group))
  for j in group:
    counter[j-1] = counter[j-1] + x[i]

print(counter)

from collections import defaultdict
N, Q = map(int, input().split())
 
tree = defaultdict(set)
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a].add(b)
    tree[b].add(a)

counter = defaultdict(int)
for i in range(Q):
    p, x = map(int, input().split())
    counter[p] += x

cur_node = set()
cur_node.add(1)
pre_node = set()
while len(cur_node) != 0:
  next_node = set()
  for ni in cur_node:
    for nj in tree[ni]:
      if nj in pre_node:
        continue
      counter[nj] += counter[ni]
      next_node.add(nj)
  pre_node = cur_node
  cur_node = next_node
print(' '.join((str(counter[i]) for i in range(1, N + 1))))
