# https://atcoder.jp/contests/abc138/tasks/abc138_d



def dfs(lst, start, ans):

    queue = [start]

    visited = [False] * len(ans)

    visited[start] = True



    while queue:

        parent = queue.pop()

        for child in lst[parent]:

            if visited[child]:

                continue

            visited[child] = True

            ans[child] += ans[parent]

            queue.append(child)



    print((*ans))



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

start = 0



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

for i in range(n-1):

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

    tree[a-1].append(b-1)

    tree[b-1].append(a-1)



ans = [0]*n

for _ in range(q):

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

    ans[p-1] += x

dfs(tree, start, ans)

# https://atcoder.jp/contests/abc138/tasks/abc138_d



def dfs(lst, start, ans):

    queue = [start]

    visited = [False] * len(ans)

    visited[start] = True



    while queue:

        parent = queue.pop()

        for child in lst[parent]:

            if visited[child]:

                continue

            visited[child] = True

            ans[child] += ans[parent]

            queue.append(child)



    print((*ans))



import sys

input = sys.stdin.readline

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

start = 0



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

for i in range(n-1):

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

    tree[a-1].append(b-1)

    tree[b-1].append(a-1)



ans = [0]*n

for _ in range(q):

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

    ans[p-1] += x

dfs(tree, start, ans)

# https://atcoder.jp/contests/abc138/tasks/abc138_d
def dfs(lst, start, ans):
    queue = [start]
    visited = [False] * len(ans)
    visited[start] = True
    while queue:
        parent = queue.pop()
        for child in lst[parent]:
            if visited[child]:
                continue
            visited[child] = True
            ans[child] += ans[parent]
            queue.append(child)
    print((*ans))


n, q = list(map(int, input().split()))
start = 0
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)
ans = [0] * n
for _ in range(q):
    p, x = list(map(int, input().split()))
    ans[p - 1] += x
dfs(tree, start, ans)

# https://atcoder.jp/contests/abc138/tasks/abc138_d
def dfs(lst, start, ans):
    queue = [start]
    visited = [False] * len(ans)
    visited[start] = True
    while queue:
        parent = queue.pop()
        for child in lst[parent]:
            if visited[child]:
                continue
            visited[child] = True
            ans[child] += ans[parent]
            queue.append(child)
    print((*ans))


import sys

input = sys.stdin.readline
n, q = list(map(int, input().split()))
start = 0
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)
ans = [0] * n
for _ in range(q):
    p, x = list(map(int, input().split()))
    ans[p - 1] += x
dfs(tree, start, ans)

+import sys + +input = sys.stdin.readline