from collections import deque
n,q=map(int,input().split())
tree=[[] for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    tree[a].append(b)
    tree[b].append(a) # 無向グラフなので
ans=[0]*n
for _ in range(q):
    p,x=map(int,input().split())
    ans[p-1]+=x

stack=deque([0]) # 根の位置、現位置の元になる根
visited=[0]*n
visited[0]=1

while stack:
    cur=stack.pop()
    for i in tree[cur]:
        if visited[i]==0:
            visited[i]=1
            ans[i]+=ans[cur]
            stack.append(i)
print(*ans)
a0b9200de2a729fde8c9de0bd2240eccfb3c754b
<mask token>

<mask token>
for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)
<mask token>
for _ in range(q):
    p, x = map(int, input().split())
    ans[p - 1] += x
<mask token>
while stack:
    cur = stack.pop()
    for i in tree[cur]:
        if visited[i] == 0:
            visited[i] = 1
            ans[i] += ans[cur]
            stack.append(i)
print(*ans)

<mask token>
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)
ans = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    ans[p - 1] += x
stack = deque([0])
visited = [0] * n
visited[0] = 1
while stack:
    cur = stack.pop()
    for i in tree[cur]:
        if visited[i] == 0:
            visited[i] = 1
            ans[i] += ans[cur]
            stack.append(i)
print(*ans)

from collections import deque
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)
ans = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    ans[p - 1] += x
stack = deque([0])
visited = [0] * n
visited[0] = 1
while stack:
    cur = stack.pop()
    for i in tree[cur]:
        if visited[i] == 0:
            visited[i] = 1
            ans[i] += ans[cur]
            stack.append(i)
print(*ans)

from collections import deque
n,q=map(int,input().split())
tree=[[] for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    tree[a].append(b)
    tree[b].append(a) # 無向グラフなので
ans=[0]*n
for _ in range(q):
    p,x=map(int,input().split())
    ans[p-1]+=x

stack=deque([0]) # 根の位置、現位置の元になる根
visited=[0]*n
visited[0]=1

while stack:
    cur=stack.pop()
    for i in tree[cur]:
        if visited[i]==0:
            visited[i]=1
            ans[i]+=ans[cur]
            stack.append(i)
print(*ans)