from operator import itemgetter

i, q = [int(x) for x in input().split(' ')]

root = Node(1)
for idx in range(i-1):
    a, b = [int(x) for x in input().split(' ')]
    root.add_child(a, b)

for _ in range(q):
    p, x = [int(x) for x in input().split(' ')]
    root.set_count(p, x)

root.add_count()

counts = sorted(root.get_counts(), key=itemgetter(0))
print(' '.join([str(x[1]) for x in counts]))


class Node:
    def __init__(self, id):
        self.id = id
        self.count = 0
        self.children = []

    def add_child(self, parent_id, child_id):
        if parent_id < self.id:
            return

        if parent_id == self.id:
            # 追加
            self.children.append(Node(child_id))
            return

        for child in self.children:
            child.add_child(parent_id, child_id)
        return

    def set_count(self, target_id, num, is_count=False):
        # if target_id == self.id:
        #     is_count = True

        # if is_count:
        #     self.count += num

        # for child in self.children:
        #     child.add_count(target_id, num, is_count)
        if target_id < self.id:
            return
        if target_id == self.id:
            self.count += num
            return
        for child in self.children:
            child.set_count(target_id, num, is_count)
        return

    def add_count(self, num=0):
        self.count += num
        for child in self.children:
            child.add_count(self.count)
        return

    def get_counts(self):
        res = [(self.id, self.count)]
        # print(self.id, self.count)
        for child in self.children:
            res += child.get_counts()
        return res
