N, Q = [int(i) for i in input().split()]



E = [[] for _ in range(N + 1)]

for _ in range(N - 1):

    a, b = [int(i) for i in input().split()]

    E[a].append(b)

    E[b].append(a)



M = [0] * (N + 1)

for _ in range(Q):

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

    M[p] += x





from collections import deque



ans = M[:]

visited = [False] * (N + 1)

visited[1] = True

Q = deque([1])

while Q:

    a = Q.popleft()

    for e in E[a]:

        if visited[e]:

            continue

        visited[e] = True

        ans[e] += ans[a]

        Q.append(e)



print((*ans[1:]))
from collections import deque

import sys

input = sys.stdin.readline



N, Q = [int(i) for i in input().split()]



E = [[] for _ in range(N + 1)]

for _ in range(N - 1):

    a, b = [int(i) for i in input().split()]

    E[a].append(b)

    E[b].append(a)



M = [0] * (N + 1)

for _ in range(Q):

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

    M[p] += x



ans = M[:]

visited = [False] * (N + 1)

visited[1] = True

Q = deque([1])

while Q:

    a = Q.popleft()

    for e in E[a]:

        if visited[e]:

            continue

        visited[e] = True

        ans[e] += ans[a]

        Q.append(e)



print((*ans[1:]))

N, Q = [int(i) for i in input().split()]
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = [int(i) for i in input().split()]
    E[a].append(b)
    E[b].append(a)
M = [0] * (N + 1)
for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    M[p] += x
from collections import deque

ans = M[:]
visited = [False] * (N + 1)
visited[1] = True
Q = deque([1])
while Q:
    a = Q.popleft()
    for e in E[a]:
        if visited[e]:
            continue
        visited[e] = True
        ans[e] += ans[a]
        Q.append(e)
print((*ans[1:]))

from collections import deque
import sys

input = sys.stdin.readline
N, Q = [int(i) for i in input().split()]
E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = [int(i) for i in input().split()]
    E[a].append(b)
    E[b].append(a)
M = [0] * (N + 1)
for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    M[p] += x
ans = M[:]
visited = [False] * (N + 1)
visited[1] = True
Q = deque([1])
while Q:
    a = Q.popleft()
    for e in E[a]:
        if visited[e]:
            continue
        visited[e] = True
        ans[e] += ans[a]
        Q.append(e)
print((*ans[1:]))

+from collections import deque +import sys + +input = sys.stdin.readline -from collections import deque -