n,q=map(int,input().split())
ans=[0]*(n+1)
score=[0]*(n+1)
g=[[] for _ in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    g[a].append(b)
for j in range(q):
    p,x=map(int,input().split())
    score[p]+=x
visited=set()
visited.add(1)
def dfs(v):
    global ans
    global score
    ans[v]+=score[v]
    for i in range(len(g[v])):
        if not g[v][i] in visited:
            ans[g[v][i]]+=ans[v]
            dfs(g[v][i])
dfs(1)
ans_chr=""
for i in range(1,n+1):
    ans_chr=ans_chr+str(ans[i])+" "
print(ans_chr)
