# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc138/tasks/abc138_d

# It's a Python porting of ki.cpp
# Mainly to understand the algorithm by myself

N, Q = list(map(int, input().split()))

tree_link = [None] * 200005
answer = [0] * N


def dfs(v, p=-1):
    for link in tree_link[v]:
        if link == p:  # 親ノードであれば continue
            continue
        answer[link] += answer[v]
        dfs(link, v)


# 双方向の辺を作る
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1

    if tree_link[a]:
        tree_link[a].append(b)
    else:
        tree_link[a] = [b]

    if tree_link[b]:
        tree_link[b].append(a)
    else:
        tree_link[b] = [a]

# 頂点に値を足し込む
for i in range(Q):
    p, x = list(map(int, input().split()))
    answer[p - 1] += x

# 計算
dfs(0)

# 出力
print(" ".join([str(answer[i]) for i in range(N)]))
