from collections import defaultdict

def dfs(graph, start):
    stack = [start]
    visited = []
    while stack:
        label = stack.pop(0)
        if label not in visited:
            visited.append(label)
            stack = graph.get(label, []) + stack
    return visited
  
tree = defaultdict(list)
N,Q = map(int, input().split())

lst1 = [list(map(int, input().split())) for i in range(N-1)]
lst2 = [list(map(int, input().split())) for i in range(Q)]
for i in range(N):
  dict(tree)[i+1] = []
for i in lst1:
  tree[i[0]].append(i[1])
ans = [0] * N
memo = {}
for i in lst2:
  start = i[0]
  visited = []
  if (start == 1):
      ans = list(map(lambda x: x + i[1], ans))
  else:
    if start not in memo.keys():
      memo[start] = dfs(dict(tree), start)
    for j in memo[start]:
      if (start <= j):
        ans[j-1] += i[1]
print(" ".join(list(map(str,ans))))