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

tree = [set() for i in range(n+1)]

for _ in range(n-1):

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

  tree[a].add(b)

  tree[b].add(a)

lazy = [0]*(n+1)

cnt = 0



for _ in range(q):

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

  lazy[x] += v



que = [(1,0)]

while que:

  v,p = que.pop()

  for x in tree[v]:

    if x == p:

      continue

    lazy[x] += lazy[v]

    que.append((x,v))



print((" ".join(map(str,lazy[1:]))))
import sys

from collections import deque



readline = sys.stdin.buffer.readline

ni = lambda: int(readline().rstrip())

nm = lambda: list(map(int, readline().split()))

nl = lambda: list(map(int, readline().split()))





def solve():

    n, Q = nm()

    G = [list() for _ in range(n)]

    for _ in range(n-1):

        u, v = nm()

        u -= 1; v -= 1

        G[u].append(v)

        G[v].append(u)

    a = [0]*n

    for _ in range(Q):

        p, x = nm()

        a[p-1] += x

    q = deque()

    q.append(0)

    seen = [1] + [0]*(n-1)

    while q:

        v = q.popleft()

        for x in G[v]:

            if not seen[x]:

                seen[x] = 1

                a[x] += a[v]

                q.append(x)

    print((*a))

    return



solve()



# T = ni()

# for _ in range(T):

#     solve()

n, q = list(map(int, input().split()))
tree = [set() for i in range(n + 1)]
for _ in range(n - 1):
    a, b = list(map(int, input().split()))
    tree[a].add(b)
    tree[b].add(a)
lazy = [0] * (n + 1)
cnt = 0
for _ in range(q):
    x, v = list(map(int, input().split()))
    lazy[x] += v
que = [(1, 0)]
while que:
    v, p = que.pop()
    for x in tree[v]:
        if x == p:
            continue
        lazy[x] += lazy[v]
        que.append((x, v))
print((" ".join(map(str, lazy[1:]))))

import sys
from collections import deque

readline = sys.stdin.buffer.readline
ni = lambda: int(readline().rstrip())
nm = lambda: list(map(int, readline().split()))
nl = lambda: list(map(int, readline().split()))


def solve():
    n, Q = nm()
    G = [list() for _ in range(n)]
    for _ in range(n - 1):
        u, v = nm()
        u -= 1
        v -= 1
        G[u].append(v)
        G[v].append(u)
    a = [0] * n
    for _ in range(Q):
        p, x = nm()
        a[p - 1] += x
    q = deque()
    q.append(0)
    seen = [1] + [0] * (n - 1)
    while q:
        v = q.popleft()
        for x in G[v]:
            if not seen[x]:
                seen[x] = 1
                a[x] += a[v]
                q.append(x)
    print((*a))
    return


solve()
# T = ni()
# for _ in range(T):
#     solve()

-n, q = list(map(int, input().split())) -tree = [set() for i in range(n + 1)] -for _ in range(n - 1): -    a, b = list(map(int, input().split())) -    tree[a].add(b) -    tree[b].add(a) -lazy = [0] * (n + 1) -cnt = 0 -for _ in range(q): -    x, v = list(map(int, input().split())) -    lazy[x] += v -que = [(1, 0)] -while que: -    v, p = que.pop() -    for x in tree[v]: -        if x == p: -            continue -        lazy[x] += lazy[v] -        que.append((x, v)) -print((" ".join(map(str, lazy[1:])))) +import sys +from collections import deque + +readline = sys.stdin.buffer.readline +ni = lambda: int(readline().rstrip()) +nm = lambda: list(map(int, readline().split())) +nl = lambda: list(map(int, readline().split())) + + +def solve(): +    n, Q = nm() +    G = [list() for _ in range(n)] +    for _ in range(n - 1): +        u, v = nm() +        u -= 1 +        v -= 1 +        G[u].append(v) +        G[v].append(u) +    a = [0] * n +    for _ in range(Q): +        p, x = nm() +        a[p - 1] += x +    q = deque() +    q.append(0) +    seen = [1] + [0] * (n - 1) +    while q: +        v = q.popleft() +        for x in G[v]: +            if not seen[x]: +                seen[x] = 1 +                a[x] += a[v] +                q.append(x) +    print((*a)) +    return + + +solve() +# T = ni() +# for _ in range(T): +#     solve()