N, Q = list(map(int, input().split()))



tree = {}

for i in range(1, N + 1):

    tree[i] = []

for i in range(N - 1):

    a, b = list(map(int, input().split()))

    tree[a] += [b]



count = [0] * (N + 1)

for i in range(Q):

    p, x = list(map(int, input().split()))

    count[p] += x



stack = [1]

while stack:

    label = stack.pop()

    if tree[label] != []:

        for next_label in tree[label]:

            count[next_label] += count[label]

        stack += tree[label]



print((*count[1:]))

import sys





def input():

    return sys.stdin.readline()[:-1]





N, Q = list(map(int, input().split()))



tree = {}

for i in range(1, N + 1):

    tree[i] = []

for i in range(N - 1):

    a, b = list(map(int, input().split()))

    tree[a] += [b]



count = [0] * (N + 1)

for i in range(Q):

    p, x = list(map(int, input().split()))

    count[p] += x



stack = [1]

while stack:

    label = stack.pop()

    if tree[label] != []:

        for next_label in tree[label]:

            count[next_label] += count[label]

        stack += tree[label]

ans = count[1:]



print((*ans))

N, Q = list(map(int, input().split()))
tree = {}
for i in range(1, N + 1):
    tree[i] = []
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    tree[a] += [b]
count = [0] * (N + 1)
for i in range(Q):
    p, x = list(map(int, input().split()))
    count[p] += x
stack = [1]
while stack:
    label = stack.pop()
    if tree[label] != []:
        for next_label in tree[label]:
            count[next_label] += count[label]
        stack += tree[label]
print((*count[1:]))

import sys


def input():
    return sys.stdin.readline()[:-1]


N, Q = list(map(int, input().split()))
tree = {}
for i in range(1, N + 1):
    tree[i] = []
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    tree[a] += [b]
count = [0] * (N + 1)
for i in range(Q):
    p, x = list(map(int, input().split()))
    count[p] += x
stack = [1]
while stack:
    label = stack.pop()
    if tree[label] != []:
        for next_label in tree[label]:
            count[next_label] += count[label]
        stack += tree[label]
ans = count[1:]
print((*ans))

+import sys + + +def input(): +    return sys.stdin.readline()[:-1] + + -print((*count[1:])) +ans = count[1:] +print((*ans))