n,q = list(map(int, input().split()))
li = [[] for i in range(n)]
ans=[0]*n


for i in range(n-1):
    a, b = list(map(int, input().split()))
    li[a-1].append(b-1)
for i in range(q):
    p, x = list(map(int, input().split()))
    ans[p-1]+=x

def dfs(now, v, p=None):
    ans[now]+=v
    for u in li[now]:
        if u== now:
            continue
        dfs(u,ans[now],now)


visited=[0]*n

dfs(0,0)
for i in ans:
    print(i)