import sys
sys.setrecursionlimit(2*10**5)
def parent(array,count,index,root):
    array[index-1].remove(root)
    count[index-1]+=count[root-1]
    for i in array[index-1]:
        parent(array,count,i,index)
num,q=map(int,input().split())
counter=[0 for _ in range(num)]
roots=[set() for _ in range(num)]
for _ in range(num-1):
    a,b=map(int,input().split())
    roots[a-1].add(b)
    roots[b-1].add(a)
for _ in range(q):
    p,x=map(int,input().split())
    counter[p-1]+=x
for ele in roots[0]:
    parent(roots,counter,ele,1)
print(" ".join([str(counter[i]) for i in range(num)]))