import sys
import numpy as np
from functools import reduce
from operator import itemgetter

N, Q = map(int,input().split())
tree_list = [list(map(int, input().split())) for i in range(N-1)]
counter = [0] * N

for i in range(Q):
    node ,inc = input().split()
    node = int(node)
    counter[node-1] = int(inc)

#sort
tree_list.sort(key=itemgetter(0))
for pa, ch in tree_list:
    counter[ch-1] += counter[pa-1]

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