def Graph():

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

    #up_G=[0]*n#up_G[i]=頂点iの親

    for _ in range(n-1):

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

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

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

    return G



from collections import deque

def bfs(G,v,p):

    #(G,v,p)=(グラフ(木の情報),探索中の頂点,vの親)

    #vの子の頂点を決めて、vをpに移す

    q=deque()

    q.append((v,p))

    while q:

        V,P=q.popleft()

        for new_v in G[V]:

            #new_vが頂点の時はアウト

            if new_v==P:continue

            ans[new_v]+=ans[V]

            q.append((new_v,V))

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

G=Graph()

ans=[0]*n

for _ in range(q):

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

    ans[p-1]+=x

bfs(G,0,-1)

print((*ans))

from collections import deque

import sys

def solve():

    input=sys.stdin.readline

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



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

    #up_G=[0]*n#up_G[i]=頂点iの親

    for _ in range(n-1):

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

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

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



    ans=[0]*n

    for _ in range(q):

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

        ans[p-1]+=x

    #(G,v,p)=(グラフ(木の情報),探索中の頂点,vの親)

    #vの子の頂点を決めて、vをpに移す

    q=deque()

    q.append((0,-1))

    while q:

        V,P=q.popleft()

        for new_v in G[V]:

            #new_vが頂点の時はアウト

            if new_v==P:continue

            ans[new_v]+=ans[V]

            q.append((new_v,V))

    print((*ans))

solve()
def Graph():
    G = [[] for i in range(n)]
    # up_G=[0]*n#up_G[i]=頂点iの親
    for _ in range(n - 1):
        a, b = list(map(int, input().split()))
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)
    return G


from collections import deque


def bfs(G, v, p):
    # (G,v,p)=(グラフ(木の情報),探索中の頂点,vの親)
    # vの子の頂点を決めて、vをpに移す
    q = deque()
    q.append((v, p))
    while q:
        V, P = q.popleft()
        for new_v in G[V]:
            # new_vが頂点の時はアウト
            if new_v == P:
                continue
            ans[new_v] += ans[V]
            q.append((new_v, V))


n, q = list(map(int, input().split()))
G = Graph()
ans = [0] * n
for _ in range(q):
    p, x = list(map(int, input().split()))
    ans[p - 1] += x
bfs(G, 0, -1)
print((*ans))

from collections import deque
import sys


def solve():
    input = sys.stdin.readline
    n, q = list(map(int, input().split()))
    G = [[] for i in range(n)]
    # up_G=[0]*n#up_G[i]=頂点iの親
    for _ in range(n - 1):
        a, b = list(map(int, input().split()))
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)
    ans = [0] * n
    for _ in range(q):
        p, x = list(map(int, input().split()))
        ans[p - 1] += x
    # (G,v,p)=(グラフ(木の情報),探索中の頂点,vの親)
    # vの子の頂点を決めて、vをpに移す
    q = deque()
    q.append((0, -1))
    while q:
        V, P = q.popleft()
        for new_v in G[V]:
            # new_vが頂点の時はアウト
            if new_v == P:
                continue
            ans[new_v] += ans[V]
            q.append((new_v, V))
    print((*ans))


solve()

-def Graph(): +from collections import deque +import sys + + +def solve(): +    input = sys.stdin.readline +    n, q = list(map(int, input().split())) -    return G - - -from collections import deque - - -def bfs(G, v, p): +    ans = [0] * n +    for _ in range(q): +        p, x = list(map(int, input().split())) +        ans[p - 1] += x -    q.append((v, p)) +    q.append((0, -1)) +    print((*ans)) -n, q = list(map(int, input().split())) -G = Graph() -ans = [0] * n -for _ in range(q): -    p, x = list(map(int, input().split())) -    ans[p - 1] += x -bfs(G, 0, -1) -print((*ans)) +solve()