import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**6)



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

AB = [[int(x) for x in input().split()] for _ in range(N-1)]

PX = [[int(x) for x in input().split()] for _ in range(Q)]

 

g = [[] for _ in range(N+1)]

for a,b in AB:

    g[a].append(b)

    g[b].append(a)

 

cnt = [0] * (N+1)

for p,x in PX:

    cnt[p] += x



def dfs(v, p, add):

    cnt[v] += add

    for nv in g[v]:

        if nv == p:

            continue

        dfs(nv, v, cnt[v])



dfs(1, 0, 0)



print((' '.join(map(str, cnt[1:]))))    
import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**6)



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



g = [[] for _ in range(N+1)]

for i in range(N-1):

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

    g[a].append(b)

    g[b].append(a)



cnt = [0] * (N+1)

for i in range(Q):

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

    cnt[p] += x



def dfs(v, p, add):

    cnt[v] += add

    for nv in g[v]:

        if nv == p:

            continue

        dfs(nv, v, cnt[v])



dfs(1, 0, 0)



print((' '.join(map(str, cnt[1:]))))     
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(N - 1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
g = [[] for _ in range(N + 1)]
for a, b in AB:
    g[a].append(b)
    g[b].append(a)
cnt = [0] * (N + 1)
for p, x in PX:
    cnt[p] += x


def dfs(v, p, add):
    cnt[v] += add
    for nv in g[v]:
        if nv == p:
            continue
        dfs(nv, v, cnt[v])


dfs(1, 0, 0)
print((" ".join(map(str, cnt[1:]))))

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = list(map(int, input().split()))
g = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    g[a].append(b)
    g[b].append(a)
cnt = [0] * (N + 1)
for i in range(Q):
    p, x = list(map(int, input().split()))
    cnt[p] += x


def dfs(v, p, add):
    cnt[v] += add
    for nv in g[v]:
        if nv == p:
            continue
        dfs(nv, v, cnt[v])


dfs(1, 0, 0)
print((" ".join(map(str, cnt[1:]))))

-AB = [[int(x) for x in input().split()] for _ in range(N - 1)] -PX = [[int(x) for x in input().split()] for _ in range(Q)] -for a, b in AB: +for i in range(N - 1): +    a, b = list(map(int, input().split())) -for p, x in PX: +for i in range(Q): +    p, x = list(map(int, input().split()))