#import sys

#import numpy as np

import math

#import itertools

#from fractions import Fraction

#import itertools

from collections import deque

from collections import Counter

#import heapq

#from fractions  import gcd

#input=sys.stdin.readline

#import bisect

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



node=[[] for _ in range(n)]

d=deque()

d.append(0)

for i in range(n-1):

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

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

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

ans=[0]*n

for i in range(q):

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

    ans[p-1]+=x

seen=[0]*n

seen[0]=1

while True:

    if not d:

        break

    i=d.pop()

    for j in node[i]:

        if seen[j]==0:

            d.append(j)

            seen[j]=1

            ans[j]+=ans[i]

print((*ans))
import sys

#import numpy as np

import math

#import itertools

#from fractions import Fraction

#import itertools

from collections import deque

from collections import Counter

#import heapq

#from fractions  import gcd

input=sys.stdin.readline

#import bisect

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



node=[[] for _ in range(n)]

d=deque()

d.append(0)

for i in range(n-1):

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

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

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

ans=[0]*n

for i in range(q):

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

    ans[p-1]+=x

seen=[0]*n

seen[0]=1

while True:

    if not d:

        break

    i=d.pop()

    for j in node[i]:

        if seen[j]==0:

            d.append(j)

            seen[j]=1

            ans[j]+=ans[i]

print((*ans))
# import sys
# import numpy as np
import math

# import itertools
# from fractions import Fraction
# import itertools
from collections import deque
from collections import Counter

# import heapq
# from fractions  import gcd
# input=sys.stdin.readline
# import bisect
n, q = list(map(int, input().split()))
node = [[] for _ in range(n)]
d = deque()
d.append(0)
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    node[a - 1].append(b - 1)
    node[b - 1].append(a - 1)
ans = [0] * n
for i in range(q):
    p, x = list(map(int, input().split()))
    ans[p - 1] += x
seen = [0] * n
seen[0] = 1
while True:
    if not d:
        break
    i = d.pop()
    for j in node[i]:
        if seen[j] == 0:
            d.append(j)
            seen[j] = 1
            ans[j] += ans[i]
print((*ans))

import sys

# import numpy as np
import math

# import itertools
# from fractions import Fraction
# import itertools
from collections import deque
from collections import Counter

# import heapq
# from fractions  import gcd
input = sys.stdin.readline
# import bisect
n, q = list(map(int, input().split()))
node = [[] for _ in range(n)]
d = deque()
d.append(0)
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    node[a - 1].append(b - 1)
    node[b - 1].append(a - 1)
ans = [0] * n
for i in range(q):
    p, x = list(map(int, input().split()))
    ans[p - 1] += x
seen = [0] * n
seen[0] = 1
while True:
    if not d:
        break
    i = d.pop()
    for j in node[i]:
        if seen[j] == 0:
            d.append(j)
            seen[j] = 1
            ans[j] += ans[i]
print((*ans))

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