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

ab=[[int(i) for i in input().split()] for j in range(n-1)]

px=[[int(i) for i in input().split()] for j in range(q)]



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

for a,b in ab:

    graph[a].append(b)

    graph[b].append(a)

    

value=[0]*(n+1)



for p,x in px:

    value[p]+=x

    

q=[(0,1)]

while q:

    parent,child = q.pop()

    value[child]+=value[parent]

    for i in graph[child]:

        if i==parent:

            continue

        q.append((child,i))

ans=' '.join(map(str,value[1:]))

print(ans)

    
import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)

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

ab=[[int(i) for i in input().split()] for j in range(n-1)]

px=[[int(i) for i in input().split()] for j in range(q)]



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

for a,b in ab:

    graph[a].append(b)

    graph[b].append(a)

    

value=[0]*(n+1)



for p,x in px:

    value[p]+=x

    

q=[(0,1)]

while q:

    parent,child = q.pop()

    value[child]+=value[parent]

    for i in graph[child]:

        if i==parent:

            continue

        q.append((child,i))

ans=' '.join(map(str,value[1:]))

print(ans)

    
n, q = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for j in range(n - 1)]
px = [[int(i) for i in input().split()] for j in range(q)]
graph = [[] for i in range(n + 1)]
for a, b in ab:
    graph[a].append(b)
    graph[b].append(a)
value = [0] * (n + 1)
for p, x in px:
    value[p] += x
q = [(0, 1)]
while q:
    parent, child = q.pop()
    value[child] += value[parent]
    for i in graph[child]:
        if i == parent:
            continue
        q.append((child, i))
ans = " ".join(map(str, value[1:]))
print(ans)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, q = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for j in range(n - 1)]
px = [[int(i) for i in input().split()] for j in range(q)]
graph = [[] for i in range(n + 1)]
for a, b in ab:
    graph[a].append(b)
    graph[b].append(a)
value = [0] * (n + 1)
for p, x in px:
    value[p] += x
q = [(0, 1)]
while q:
    parent, child = q.pop()
    value[child] += value[parent]
    for i in graph[child]:
        if i == parent:
            continue
        q.append((child, i))
ans = " ".join(map(str, value[1:]))
print(ans)

+import sys + +input = sys.stdin.readline +sys.setrecursionlimit(10**7)