I0 = lambda :list(map(int,input().split()))

I1 = lambda :int(eval(input()))

I2 = lambda :list(map(int,input().split()))

#####################################################

n ,q = I0()

counter = [0]*n

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

for i in range(n-1):

    a,b=I0()

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

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

 

for i in range(q):

    p,x = I0()

    counter[p-1]+=x



stack = [0]

seen = dict()

seen[0] = 1

while stack:

    yy = stack.pop()

    for i in tree[yy]:

        if seen.get(i,-1) == -1:

            seen[i] = 1

            counter[i]+=counter[yy]

            stack.append(i)

            

print((*counter))
I0 = lambda :list(map(int,input().split()))

I1 = lambda :int(eval(input()))

I2 = lambda :list(map(int,input().split()))

#####################################################

import sys

input=sys.stdin.readline

n ,q = I0()

counter = [0]*n

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

for i in range(n-1):

    a,b=I0()

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

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



for i in range(q):

    p,x = I0()

    counter[p-1]+=x

    

stack = [0]

seen = dict()

seen[0] = 1

while stack:

    yy = stack.pop()

    for i in tree[yy]:

        if seen.get(i,-1) == -1:

            seen[i] = 1

            counter[i]+=counter[yy]

            stack.append(i)

            

print((*counter))



I0 = lambda: list(map(int, input().split()))
I1 = lambda: int(eval(input()))
I2 = lambda: list(map(int, input().split()))
#####################################################
n, q = I0()
counter = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = I0()
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)
for i in range(q):
    p, x = I0()
    counter[p - 1] += x
stack = [0]
seen = dict()
seen[0] = 1
while stack:
    yy = stack.pop()
    for i in tree[yy]:
        if seen.get(i, -1) == -1:
            seen[i] = 1
            counter[i] += counter[yy]
            stack.append(i)
print((*counter))

I0 = lambda: list(map(int, input().split()))
I1 = lambda: int(eval(input()))
I2 = lambda: list(map(int, input().split()))
#####################################################
import sys

input = sys.stdin.readline
n, q = I0()
counter = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = I0()
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)
for i in range(q):
    p, x = I0()
    counter[p - 1] += x
stack = [0]
seen = dict()
seen[0] = 1
while stack:
    yy = stack.pop()
    for i in tree[yy]:
        if seen.get(i, -1) == -1:
            seen[i] = 1
            counter[i] += counter[yy]
            stack.append(i)
print((*counter))

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