class Node:
    def __init__(self, parent, num):
        self.parent = parent
        self.num = num
        self.score = 0

    def add_score(self, score):
        self.score += score

class Tree:
    @classmethod
    def calc_sum(cls, node):
        if node.parent:
            return node.score + cls.calc_sum(node.parent)
        else:
            return node.score

N, Q = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(1, N):
    A[i], B[i] = map(int, input().split())

P = [0] * (Q+1)
X = [0] * (Q+1)
for i in range(1, Q+1):
    P[i], X[i] = map(int, input().split())

nodes = [0] * (N+1)
nodes[1] = Node(None, 1)

for i in range(1, N):
    nodes[B[i]] = Node(nodes[A[i]], B[i])

for i in range(1, Q+1):
    nodes[P[i]].add_score(X[i])

for i in range(1, N+1):
    sum_score = Tree.calc_sum(nodes[i])
    print(sum_score, end=' ')
