import collections
n, q = map(int, input().split())

tree = collections.defaultdict(list)
counter = {}
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a].append(b)
    counter[a] = 0
    counter[b] = 0

for _ in range(q):
    p, x = map(int, input().split())

    def add(p_, x_):
        counter[p_] += x_
        for v in tree[p_]:
            add(v, x_)

    add(p, x)

print(' '.join(str(v) for _, v in sorted(counter.items(), key=lambda x: x[0])))
