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



F = [0 for i in range(N)]

T = [[]for i in range(N)]



for i in range(N-1):

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

    T[a-1].append(b-1)

    T[b-1].append(a-1)



X = [0 for i in range(N)]

for i in range(Q):

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

    X[p-1] += x



ans = [X[i] for i in range(N)]

for i in range(N):

    F[i] = 1

    for j in range(len(T[i])):

        if F[T[i][j]] == 1:

            continue

        ans[T[i][j]] += ans[i]



for i in range(N):

    print(ans[i], end =" ")

import sys

input = sys.stdin.readline



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



F = [0 for i in range(N)]

T = [[]for i in range(N)]



for i in range(N-1):

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

    T[a-1].append(b-1)

    T[b-1].append(a-1)



X = [0 for i in range(N)]

for i in range(Q):

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

    X[p-1] += x



ans = [X[i] for i in range(N)]

for i in range(N):

    F[i] = 1

    for j in range(len(T[i])):

        if F[T[i][j]] == 1:

            continue

        ans[T[i][j]] += ans[i]



for i in range(N):

    print(ans[i], end =" ")

N, Q = map(int, input().split())
F = [0 for i in range(N)]
T = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    T[a - 1].append(b - 1)
    T[b - 1].append(a - 1)
X = [0 for i in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    X[p - 1] += x
ans = [X[i] for i in range(N)]
for i in range(N):
    F[i] = 1
    for j in range(len(T[i])):
        if F[T[i][j]] == 1:
            continue
        ans[T[i][j]] += ans[i]
for i in range(N):
    print(ans[i], end=" ")

import sys

input = sys.stdin.readline
N, Q = map(int, input().split())
F = [0 for i in range(N)]
T = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    T[a - 1].append(b - 1)
    T[b - 1].append(a - 1)
X = [0 for i in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    X[p - 1] += x
ans = [X[i] for i in range(N)]
for i in range(N):
    F[i] = 1
    for j in range(len(T[i])):
        if F[T[i][j]] == 1:
            continue
        ans[T[i][j]] += ans[i]
for i in range(N):
    print(ans[i], end=" ")

+import sys + +input = sys.stdin.readline