import sys

sys.setrecursionlimit(10**9)

input = sys.stdin.readline

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

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

for _ in range(n-1):

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

    a -= 1

    b -= 1

    d[a].append(b)

    d[b].append(a)

d2 = [0] * n

for _ in range(q):

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

    d2[p-1] += x



ans = [0] * n



def dfs(cur, pre, point):

    point += d2[cur]

    ans[cur] = point

    for e in d[cur]:

        if e != pre:

            dfs(e, cur, point)

dfs(0, -1, 0)

print((" ".join(map(str, ans))))

import sys

sys.setrecursionlimit(10**9)

input = sys.stdin.readline

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

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

for _ in range(n-1):

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

    a -= 1

    b -= 1

    d[a].append(b)

    d[b].append(a)

d2 = [0] * n

for _ in range(q):

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

    d2[p-1] += x



ans = [0] * n



from collections import deque



def dfs(cur, pre, point):

    stack = deque([[cur, pre, point]])

    while stack:

        cur, pre, point = stack.pop()

        point += d2[cur]

        ans[cur] = point

        for e in d[cur]:

            if e != pre:

                stack.append([e, cur, point])



dfs(0, -1, 0)

print((" ".join(map(str, ans))))

import sys

sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
d = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    d[a].append(b)
    d[b].append(a)
d2 = [0] * n
for _ in range(q):
    p, x = list(map(int, input().split()))
    d2[p - 1] += x
ans = [0] * n


def dfs(cur, pre, point):
    point += d2[cur]
    ans[cur] = point
    for e in d[cur]:
        if e != pre:
            dfs(e, cur, point)


dfs(0, -1, 0)
print((" ".join(map(str, ans))))

import sys

sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
d = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    d[a].append(b)
    d[b].append(a)
d2 = [0] * n
for _ in range(q):
    p, x = list(map(int, input().split()))
    d2[p - 1] += x
ans = [0] * n
from collections import deque


def dfs(cur, pre, point):
    stack = deque([[cur, pre, point]])
    while stack:
        cur, pre, point = stack.pop()
        point += d2[cur]
        ans[cur] = point
        for e in d[cur]:
            if e != pre:
                stack.append([e, cur, point])


dfs(0, -1, 0)
print((" ".join(map(str, ans))))

+from collections import deque -    point += d2[cur] -    ans[cur] = point -    for e in d[cur]: -        if e != pre: -            dfs(e, cur, point) +    stack = deque([[cur, pre, point]]) +    while stack: +        cur, pre, point = stack.pop() +        point += d2[cur] +        ans[cur] = point +        for e in d[cur]: +            if e != pre: +                stack.append([e, cur, point])