import sys

def add_count(addnum, relations, counters, nodelist):
  new_nodelist = []
  for node in nodelist:
    if node not in relations:
      continue
    else:
      new_nodelist = new_nodelist + relations[node]
      for child in relations[node]:
        counters[child-1] += addnum
  
  if len(new_nodelist) == 0:
    return counters
  else:
    return add_count(addnum, relations, counters, new_nodelist)

N, Q = map(int, sys.stdin.readline().split())
alist = list(list(map(int, sys.stdin.readline().split())) for i in range(N-1))
qlist = list(list(map(int, sys.stdin.readline().split())) for i in range(Q))

counters = [0 for i in range(N)]
relations = {}
for a in alist:
  if a[0] not in relations:
    relations[a[0]] = [a[1]]
  else:
    relations[a[0]].append(a[1])
    
for q in qlist:
  counters[q[0]-1] += q[1]
  counters = add_count(q[1], relations, counters, [q[0]])

print(' '.join(map(str,counters)))