from collections import deque

n,q = map(int,input().split())
E = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
 

score = [0]*n
for i in range(q):
    a,b = map(int,input().split())
    score[a-1] += b

def bfs(i):
    s = -1
    q = deque([])
    q.append((i-1,s))
    while q:
        
        num,bef = q.pop()
        for j in E[num]:
            if j == bef:
                continue
            else:
                score[j] += score[num]
                q.append((j,num))
            
    return score
print(*bfs(1))


    


