### BUGGY CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

N, Q = LI()
AB = []
PX = []
for i in range(N-1):
    AB.append(LI())

for i in range(Q):
    PX.append(LI())

"""
そもそも各頂点の部分木をdictに入れましょうか？
参照するような形で。
2には3
3には4,5
4,5はNoneだと、参照しやすいか？


"""

AB = sorted(AB, key=lambda x: x[1], reverse=True)

perr('AB')
perr(AB)
d = {}
for a, b in AB:
    # abの頂点若い方に足していく
    if a not in d.keys():
        d[a] = []
    if b not in d.keys():
        d[a].append(b)
    else:
        d[a].append(b)
        d[a].extend(d[b])

perr('d')
perr(d)

#  ans = [0 for _ in range(N)]
items_to_add = [0 for _ in range(N)]
for p, x in PX:
    items_to_add[p-1] += x
perr(items_to_add)

ans = {}
for idx, item in enumerate(items_to_add):
    if idx+1 not in ans.keys():
        ans[idx+1] = 0

    ans[idx+1] += item
    if idx+1 not in d.keys():
        continue
    for i in d[idx+1]:
        if i not in ans.keys():
            ans[i] = 0
        perr('i')
        perr(i)
        ans[i] += item

#  for p, x in PX:
#      perr('px')
#      perr([p, x])
#      ans[p-1] += x
#      if p not in d.keys():
#          continue
#      for i in d[p]:
#          perr('i')
#          perr(i)
#          ans[i-1] += x

perr('ans')
perr(ans)
for i in range(1, N+1):
    print(ans[i], end=' ')


### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

if 'LOCAL' in os.environ:
    N = 2* 10** 5
    Q = 2 * 10 ** 5
    AB = [[i, i + 1] for i in range(1, N)]
    PX = [[i, 10] for i in range(Q)]
else:
    N, Q = LI()
    AB = []
    PX = []
    for i in range(N-1):
        AB.append(LI())

    for i in range(Q):
        PX.append(LI())


"""
そもそも各頂点の部分木をdictに入れましょうか？
参照するような形で。
2には3
3には4,5
4,5はNoneだと、参照しやすいか？

カウントを若い順にやっていく
"""
AB = sorted(AB, key=lambda x: x[0])
perr('AB')
perr(AB)
d = {}
for p, x in PX:
    if p not in d.keys():
        d[p] = 0
    d[p] += x
for a, b in AB:
    if b not in d.keys():
        d[b] = 0
    if a not in d.keys():
        d[a] = 0
    d[b] += d[a]
for i in range(1, N+1):
    print(d[i], end=' ')