n, q = [ int(v) for v in input().split() ]

value_list = [ 0 for i in range(n) ]

connect_list = [ [] for i in range(n) ]

for i in range(n-1):

    a, b = [ int(v)-1 for v in input().split() ]

    connect_list[a].append(b)

    connect_list[b].append(a)

for i in range(q):

    c, p = [ int(v)-1 for v in input().split() ]

    value_list[c] += p + 1





serached_list = [ 0 for i in range(n) ]



search_list= connect_list[0]

serached_list[0] = 1

for i in connect_list[0]:

    value_list[i] += value_list[0] 





while search_list != []:

    new_search_list = []

    for i in search_list:

        serached_list[i] = 1

        for j in connect_list[i]:

            if serached_list[j] == 0:

                value_list[j] += value_list[i] 

                new_search_list.append(j)

    search_list = new_search_list

print((*value_list))
import sys

input = sys.stdin.readline



n, q = [ int(v) for v in input().split() ]

value_list = [ 0 for i in range(n) ]

connect_list = [ [] for i in range(n) ]

for i in range(n-1):

    a, b = [ int(v)-1 for v in input().split() ]

    connect_list[a].append(b)

    connect_list[b].append(a)

for i in range(q):

    c, p = [ int(v)-1 for v in input().split() ]

    value_list[c] += p + 1





serached_list = [ 0 for i in range(n) ]



search_list= connect_list[0]

serached_list[0] = 1

for i in connect_list[0]:

    value_list[i] += value_list[0] 





while search_list != []:

    new_search_list = []

    for i in search_list:

        serached_list[i] = 1

        for j in connect_list[i]:

            if serached_list[j] == 0:

                value_list[j] += value_list[i] 

                new_search_list.append(j)

    search_list = new_search_list

print((*value_list))

n, q = [int(v) for v in input().split()]
value_list = [0 for i in range(n)]
connect_list = [[] for i in range(n)]
for i in range(n - 1):
    a, b = [int(v) - 1 for v in input().split()]
    connect_list[a].append(b)
    connect_list[b].append(a)
for i in range(q):
    c, p = [int(v) - 1 for v in input().split()]
    value_list[c] += p + 1
serached_list = [0 for i in range(n)]
search_list = connect_list[0]
serached_list[0] = 1
for i in connect_list[0]:
    value_list[i] += value_list[0]
while search_list != []:
    new_search_list = []
    for i in search_list:
        serached_list[i] = 1
        for j in connect_list[i]:
            if serached_list[j] == 0:
                value_list[j] += value_list[i]
                new_search_list.append(j)
    search_list = new_search_list
print((*value_list))

import sys

input = sys.stdin.readline
n, q = [int(v) for v in input().split()]
value_list = [0 for i in range(n)]
connect_list = [[] for i in range(n)]
for i in range(n - 1):
    a, b = [int(v) - 1 for v in input().split()]
    connect_list[a].append(b)
    connect_list[b].append(a)
for i in range(q):
    c, p = [int(v) - 1 for v in input().split()]
    value_list[c] += p + 1
serached_list = [0 for i in range(n)]
search_list = connect_list[0]
serached_list[0] = 1
for i in connect_list[0]:
    value_list[i] += value_list[0]
while search_list != []:
    new_search_list = []
    for i in search_list:
        serached_list[i] = 1
        for j in connect_list[i]:
            if serached_list[j] == 0:
                value_list[j] += value_list[i]
                new_search_list.append(j)
    search_list = new_search_list
print((*value_list))

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