n, q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n-1)]
px = [list(map(int, input().split())) for _ in range(q)]
ab.sort()
cnt = [0]*n

for i in px:
    cnt[i[0] - 1] += i[1]
for j in ab:
    cnt[j[1]-1] += cnt[j[0]-1]

print(*cnt)
