from collections import deque





def bfs():

  d.append(0)

  trace[0] = 1

 

  while d:

    now = d.pop()

    for next in g[now]:

      if trace[next] == 0:

        trace[next] = 1

        score[next] += score[now]

        d.append(next)





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

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



trace = [0]*n#頂点の個数

score = [0]*n



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)



for i in range(q):

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

  p -= 1

  score[p] += x



d = deque([])



bfs()

      

print((*score))
#上流からスコアが流れてくるイメージ

from sys import stdin

from collections import deque

input = stdin.readline





def bfs():

  d.append(0)

  trace[0] = 1

 

  while d:

    now = d.pop()

    for next in g[now]:

      if trace[next] == 0:

        trace[next] = 1

        score[next] += score[now]

        d.append(next)





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

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



trace = [0]*n#頂点の個数

score = [0]*n



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)



for i in range(q):

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

  p -= 1

  score[p] += x



d = deque([])



bfs()

      

print((*score))
from collections import deque


def bfs():
    d.append(0)
    trace[0] = 1
    while d:
        now = d.pop()
        for next in g[now]:
            if trace[next] == 0:
                trace[next] = 1
                score[next] += score[now]
                d.append(next)


n, q = list(map(int, input().split()))
g = [[] for i in range(n)]
trace = [0] * n  # 頂点の個数
score = [0] * n
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)
for i in range(q):
    p, x = list(map(int, input().split()))
    p -= 1
    score[p] += x
d = deque([])
bfs()
print((*score))

# 上流からスコアが流れてくるイメージ
from sys import stdin
from collections import deque

input = stdin.readline


def bfs():
    d.append(0)
    trace[0] = 1
    while d:
        now = d.pop()
        for next in g[now]:
            if trace[next] == 0:
                trace[next] = 1
                score[next] += score[now]
                d.append(next)


n, q = list(map(int, input().split()))
g = [[] for i in range(n)]
trace = [0] * n  # 頂点の個数
score = [0] * n
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)
for i in range(q):
    p, x = list(map(int, input().split()))
    p -= 1
    score[p] += x
d = deque([])
bfs()
print((*score))

+# 上流からスコアが流れてくるイメージ +from sys import stdin + +input = stdin.readline