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



G=[]

for i in range(N):

    G.append([])

for i in range(N-1):

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

    a-=1

    b-=1

    G[a].append(b)

    G[b].append(a)



p=[0]*Q

x=[0]*Q

c=[0]*N

for i in range(Q):

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

    p-=1

    c[p] += x



stack=[0]

parent = [-1]*N



while(stack):

    v = stack.pop()

    for u in G[v]:

        if u!=parent[v]:

            c[u]+=c[v]

            parent[u]=v

            stack.append(u)





ans = ' '.join([str(x) for x in c])



print(ans)
import sys

from collections import deque

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

N,Q = [int(i) for i in sys.stdin.readline().split()]

G=[]

for i in range(N):

    G.append([])



for i in range(N-1):

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

    a,b = [int(j) for j in sys.stdin.readline().split()]

    a-=1

    b-=1

    G[a].append(b)

    G[b].append(a)



p=[0]*Q

x=[0]*Q

c=[0]*N



for i in range(Q):

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

    p,x = [int(j) for j in sys.stdin.readline().split()]

    p-=1

    c[p] += x



stack=deque([0])

parent = [-1]*N



while(stack):

    v = stack.pop()

    for u in G[v]:

        if u!=parent[v]:

            c[u]+=c[v]

            parent[u]=v

            stack.append(u)





ans = ' '.join([str(x) for x in c])



print(ans)
N, Q = list(map(int, input().split()))
G = []
for i in range(N):
    G.append([])
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
p = [0] * Q
x = [0] * Q
c = [0] * N
for i in range(Q):
    p, x = list(map(int, input().split()))
    p -= 1
    c[p] += x
stack = [0]
parent = [-1] * N
while stack:
    v = stack.pop()
    for u in G[v]:
        if u != parent[v]:
            c[u] += c[v]
            parent[u] = v
            stack.append(u)
ans = " ".join([str(x) for x in c])
print(ans)

import sys
from collections import deque

# N,Q = list(map(int,input().split()))
N, Q = [int(i) for i in sys.stdin.readline().split()]
G = []
for i in range(N):
    G.append([])
for i in range(N - 1):
    # a,b = list(map(int,input().split()))
    a, b = [int(j) for j in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
p = [0] * Q
x = [0] * Q
c = [0] * N
for i in range(Q):
    # p,x = list(map(int,input().split()))
    p, x = [int(j) for j in sys.stdin.readline().split()]
    p -= 1
    c[p] += x
stack = deque([0])
parent = [-1] * N
while stack:
    v = stack.pop()
    for u in G[v]:
        if u != parent[v]:
            c[u] += c[v]
            parent[u] = v
            stack.append(u)
ans = " ".join([str(x) for x in c])
print(ans)

-N, Q = list(map(int, input().split())) +import sys +from collections import deque + +# N,Q = list(map(int,input().split())) +N, Q = [int(i) for i in sys.stdin.readline().split()] -    a, b = list(map(int, input().split())) +    # a,b = list(map(int,input().split())) +    a, b = [int(j) for j in sys.stdin.readline().split()] -    p, x = list(map(int, input().split())) +    # p,x = list(map(int,input().split())) +    p, x = [int(j) for j in sys.stdin.readline().split()] -stack = [0] +stack = deque([0])