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

 

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

 

for i in range(N-1):

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

        a,b = a-1,b-1

        e_list[a].append(b)

        e_list[b].append(a)

 

add_list = [0]*N

 

for i in range(Q):

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

        p = p-1

        add_list[p]+=x

 

count_list = [0]*N

count_list[0] = add_list[0]

 

vi = 0 #時と場合によってここを変える

from collections import deque

Q = deque([vi])

checked_list = [False]*N

checked_list[vi]=True

while len(Q)>0:

    v = Q.pop()

    for v1 in e_list[v]:

        if not checked_list[v1]:

            checked_list[v1]=True

            Q.appendleft(v1)

            count_list[v1] = count_list[v]+add_list[v1]

 

print((*count_list))
import sys

def input():

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



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

 

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

 

for i in range(N-1):

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

        a,b = a-1,b-1

        e_list[a].append(b)

        e_list[b].append(a)

 

add_list = [0]*N

 

for i in range(Q):

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

        p = p-1

        add_list[p]+=x

 

count_list = [0]*N

count_list[0] = add_list[0]

 

vi = 0 #時と場合によってここを変える

from collections import deque

Q = deque([vi])

checked_list = [False]*N

checked_list[vi]=True

while len(Q)>0:

    v = Q.pop()

    for v1 in e_list[v]:

        if not checked_list[v1]:

            checked_list[v1]=True

            Q.appendleft(v1)

            count_list[v1] = count_list[v]+add_list[v1]

 

print((*count_list))
N, Q = list(map(int, input().split()))
e_list = [[] for i in range(N)]
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    e_list[a].append(b)
    e_list[b].append(a)
add_list = [0] * N
for i in range(Q):
    p, x = list(map(int, input().split()))
    p = p - 1
    add_list[p] += x
count_list = [0] * N
count_list[0] = add_list[0]
vi = 0  # 時と場合によってここを変える
from collections import deque

Q = deque([vi])
checked_list = [False] * N
checked_list[vi] = True
while len(Q) > 0:
    v = Q.pop()
    for v1 in e_list[v]:
        if not checked_list[v1]:
            checked_list[v1] = True
            Q.appendleft(v1)
            count_list[v1] = count_list[v] + add_list[v1]
print((*count_list))

import sys


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


N, Q = list(map(int, input().split()))
e_list = [[] for i in range(N)]
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    e_list[a].append(b)
    e_list[b].append(a)
add_list = [0] * N
for i in range(Q):
    p, x = list(map(int, input().split()))
    p = p - 1
    add_list[p] += x
count_list = [0] * N
count_list[0] = add_list[0]
vi = 0  # 時と場合によってここを変える
from collections import deque

Q = deque([vi])
checked_list = [False] * N
checked_list[vi] = True
while len(Q) > 0:
    v = Q.pop()
    for v1 in e_list[v]:
        if not checked_list[v1]:
            checked_list[v1] = True
            Q.appendleft(v1)
            count_list[v1] = count_list[v] + add_list[v1]
print((*count_list))

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