#import sys

#input = sys.stdin.readline



n,q = list(map(int,input().split()))

AB = [[int(x) for x in input().split()] for _ in range(n-1)]

PX = [[int(x) for x in input().split()] for _ in range(q)]



Graph = [[] for _ in range(n+1)]

for a,b in AB:

    Graph[a].append(b)

    Graph[b].append(a)



#print(Graph)

Value = [0]*(n+1)

for p,x in PX:

    Value[p] += x

#print(Value)



q = [(1,0)]

while q:

    x,parent = q.pop()

    Value[x] += Value[parent]  #親の値を子に入れる

    for y in Graph[x]:

        if y == parent:

            continue

        q.append((y,x))

print((*Value[1:]))
import sys

input = sys.stdin.readline



n,q = list(map(int,input().split()))

AB = [[int(x) for x in input().split()] for _ in range(n-1)]

PX = [[int(x) for x in input().split()] for _ in range(q)]



Graph = [[] for _ in range(n+1)]

for a,b in AB:

    Graph[a].append(b)

    Graph[b].append(a)



#print(Graph)

Value = [0]*(n+1)

for p,x in PX:

    Value[p] += x

#print(Value)



q = [(1,0)]

while q:

    x,parent = q.pop()

    Value[x] += Value[parent]  #親の値を子に入れる

    for y in Graph[x]:

        if y == parent:

            continue

        q.append((y,x))

print((*Value[1:]))
# import sys
# input = sys.stdin.readline
n, q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(n - 1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]
Graph = [[] for _ in range(n + 1)]
for a, b in AB:
    Graph[a].append(b)
    Graph[b].append(a)
# print(Graph)
Value = [0] * (n + 1)
for p, x in PX:
    Value[p] += x
# print(Value)
q = [(1, 0)]
while q:
    x, parent = q.pop()
    Value[x] += Value[parent]  # 親の値を子に入れる
    for y in Graph[x]:
        if y == parent:
            continue
        q.append((y, x))
print((*Value[1:]))

import sys

input = sys.stdin.readline
n, q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(n - 1)]
PX = [[int(x) for x in input().split()] for _ in range(q)]
Graph = [[] for _ in range(n + 1)]
for a, b in AB:
    Graph[a].append(b)
    Graph[b].append(a)
# print(Graph)
Value = [0] * (n + 1)
for p, x in PX:
    Value[p] += x
# print(Value)
q = [(1, 0)]
while q:
    x, parent = q.pop()
    Value[x] += Value[parent]  # 親の値を子に入れる
    for y in Graph[x]:
        if y == parent:
            continue
        q.append((y, x))
print((*Value[1:]))

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