import sys

sys.setrecursionlimit(1000000)

N, Q = list(map(int, sys.stdin.readline().split()))

a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N-1)]

p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]



rin = [[] for _ in range(N)]

for v in a_b:

    rin[v[0]-1].append(v[1]-1)

    rin[v[1]-1].append(v[0]-1)



score = [0 for _ in range(N)]

for ele in p_x:

    score[ele[0]-1] +=ele[1]

#print(score)



def dfs(p, bp=-1):

    for c in rin[p]:

        if c != bp:

            #print(c)

            score[c]+= score[p]

            dfs(c, p)



dfs(0)

print((*score))
# -*- coding:utf-8 -*-

import sys

sys.setrecursionlimit(1000000)



"""解説

いもす法っぽいことする

[入力例]

4 3

1 2

2 3

2 4

2 10

1 100

3 1



[出力例]

"""

def solve():

    N, Q = list(map(int, sys.stdin.readline().split()))

    to = [[] for _ in range(N)]  # 木



    for _ in range(N-1):

        a, b = list(map(int, sys.stdin.readline().split()))

        a, b = a-1, b-1  # 0始まりになるように

        to[a].append(b)  # 無向グラフになるように両方に加える

        to[b].append(a)  # 無向グラフになるように両方に加える



    #print(to)



    ans = [0 for _ in range(N)]

    for _ in range(Q):

        p, x = list(map(int, sys.stdin.readline().split()))

        p = p-1  # 0始まりになるように

        ans[p] += x



    #print(ans)



    def dfs(v, p=-1):

        for u in to[v]:

            if u==p: continue

            ans[u] += ans[v]  # いもす法っぽい累積和をする

            dfs(u, v)



    dfs(0)



    print((*ans))





if __name__ == "__main__":

    solve()

import sys

sys.setrecursionlimit(1000000)
N, Q = list(map(int, sys.stdin.readline().split()))
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N - 1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
rin = [[] for _ in range(N)]
for v in a_b:
    rin[v[0] - 1].append(v[1] - 1)
    rin[v[1] - 1].append(v[0] - 1)
score = [0 for _ in range(N)]
for ele in p_x:
    score[ele[0] - 1] += ele[1]
# print(score)
def dfs(p, bp=-1):
    for c in rin[p]:
        if c != bp:
            # print(c)
            score[c] += score[p]
            dfs(c, p)


dfs(0)
print((*score))

# -*- coding:utf-8 -*-
import sys

sys.setrecursionlimit(1000000)
"""解説
いもす法っぽいことする
[入力例]
4 3
1 2
2 3
2 4
2 10
1 100
3 1
[出力例]
"""


def solve():
    N, Q = list(map(int, sys.stdin.readline().split()))
    to = [[] for _ in range(N)]  # 木
    for _ in range(N - 1):
        a, b = list(map(int, sys.stdin.readline().split()))
        a, b = a - 1, b - 1  # 0始まりになるように
        to[a].append(b)  # 無向グラフになるように両方に加える
        to[b].append(a)  # 無向グラフになるように両方に加える
    # print(to)
    ans = [0 for _ in range(N)]
    for _ in range(Q):
        p, x = list(map(int, sys.stdin.readline().split()))
        p = p - 1  # 0始まりになるように
        ans[p] += x
    # print(ans)
    def dfs(v, p=-1):
        for u in to[v]:
            if u == p:
                continue
            ans[u] += ans[v]  # いもす法っぽい累積和をする
            dfs(u, v)

    dfs(0)
    print((*ans))


if __name__ == "__main__":
    solve()

+# -*- coding:utf-8 -*- -N, Q = list(map(int, sys.stdin.readline().split())) -a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N - 1)] -p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)] -rin = [[] for _ in range(N)] -for v in a_b: -    rin[v[0] - 1].append(v[1] - 1) -    rin[v[1] - 1].append(v[0] - 1) -score = [0 for _ in range(N)] -for ele in p_x: -    score[ele[0] - 1] += ele[1] -# print(score) -def dfs(p, bp=-1): -    for c in rin[p]: -        if c != bp: -            # print(c) -            score[c] += score[p] -            dfs(c, p) +"""解説 +いもす法っぽいことする +[入力例] +4 3 +1 2 +2 3 +2 4 +2 10 +1 100 +3 1 +[出力例] +""" -dfs(0) -print((*score)) +def solve(): +    N, Q = list(map(int, sys.stdin.readline().split())) +    to = [[] for _ in range(N)]  # 木 +    for _ in range(N - 1): +        a, b = list(map(int, sys.stdin.readline().split())) +        a, b = a - 1, b - 1  # 0始まりになるように +        to[a].append(b)  # 無向グラフになるように両方に加える +        to[b].append(a)  # 無向グラフになるように両方に加える +    # print(to) +    ans = [0 for _ in range(N)] +    for _ in range(Q): +        p, x = list(map(int, sys.stdin.readline().split())) +        p = p - 1  # 0始まりになるように +        ans[p] += x +    # print(ans) +    def dfs(v, p=-1): +        for u in to[v]: +            if u == p: +                continue +            ans[u] += ans[v]  # いもす法っぽい累積和をする +            dfs(u, v) + +    dfs(0) +    print((*ans)) + + +if __name__ == "__main__": +    solve()