from collections import deque



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

table = [[] for i in range(N)]

for i in range(N-1):

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

  a -= 1

  b -= 1

  table[a].append(b)

  table[b].append(a)

task = [0]*N

point = [-1]*N

point[0] = 0

for i in range(Q):

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

  p -= 1

  task[p] += x

H = deque()

H.append(0)



while H:

  p = H.popleft()

  point[p] += task[p]

  for np in table[p]:

    if point[np] == -1:

      H.append(np)

      point[np] = point[p]



for i in range(N):

  print((point[i]))

from collections import deque

import sys

input = sys.stdin.readline



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

table = [[] for i in range(N)]

for i in range(N-1):

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

  a -= 1

  b -= 1

  table[a].append(b)

  table[b].append(a)

task = [0]*N

point = [-1]*N

point[0] = 0

for i in range(Q):

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

  p -= 1

  task[p] += x

H = deque()

H.append(0)



while H:

  p = H.popleft()

  point[p] += task[p]

  for np in table[p]:

    if point[np] == -1:

      H.append(np)

      point[np] = point[p]



for i in range(N):

  print((point[i]))

from collections import deque

N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    table[a].append(b)
    table[b].append(a)
task = [0] * N
point = [-1] * N
point[0] = 0
for i in range(Q):
    p, x = list(map(int, input().split()))
    p -= 1
    task[p] += x
H = deque()
H.append(0)
while H:
    p = H.popleft()
    point[p] += task[p]
    for np in table[p]:
        if point[np] == -1:
            H.append(np)
            point[np] = point[p]
for i in range(N):
    print((point[i]))

from collections import deque
import sys

input = sys.stdin.readline
N, Q = list(map(int, input().split()))
table = [[] for i in range(N)]
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    table[a].append(b)
    table[b].append(a)
task = [0] * N
point = [-1] * N
point[0] = 0
for i in range(Q):
    p, x = list(map(int, input().split()))
    p -= 1
    task[p] += x
H = deque()
H.append(0)
while H:
    p = H.popleft()
    point[p] += task[p]
    for np in table[p]:
        if point[np] == -1:
            H.append(np)
            point[np] = point[p]
for i in range(N):
    print((point[i]))

+import sys +input = sys.stdin.readline