import sys
sys.setrecursionlimit(1000000)


class CountTree:
    def __init__(self, relations):
        self.relations = relations
        self.desc = [set() for _ in range(len(relations))]
        self._find_desc([1])
        self.counter = [0] * len(relations)

    def _find_desc(self, done, v=1):
        for desc in self.relations[v]:
            if desc in done:
                continue
            done.append(desc)
            self.desc[v].add(desc)
            self._find_desc(done, desc)

    def inc(self, p, x):
        self.counter[p] += x
        for d in self.desc[p]:
            self.inc(d, x)

    def p_cnt(self):
        print(*self.counter[1:])


N, Q = map(int, input().split())
relations = [None] + [set() for _ in range(N)]
for _ in range(N - 1):
    ai, bi = map(int, input().split())
    relations[ai].add(bi)
    relations[bi].add(ai)
ct = CountTree(relations)
for _ in range(Q):
    pi, xi = map(int, input().split())
    ct.inc(pi, xi)
ct.p_cnt()