import sys
sys.setrecursionlimit(999999)
input = sys.stdin.readline
tree = []
cnt = []

def add_cnt(p,x):
    cnt[p] += x
    for b in tree[p]:
        add_cnt(b,x)

n,q = map(int,input().split())
tree = [[] for _ in range(n+1)]
cnt = [0 for _ in range(n+1)]

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

for _ in range(q):
    p, x = map(int,input().split())
    add_cnt(p,x)

for i in range(1,n+1):
    print (cnt[i],end=' ')