
import sys
input = sys.stdin.readline

n, q = [int(x) for x in input().split()]

edge = [[] for _ in range(n)]

counter = [0] * n

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

for _ in range(q):
    a, b = [int(x) for x in input().split()]
    counter[a-1] += b

parent = [0]

for i in parent:
    for v in edge[i]:
        if v in parent:
            continue
        parent.append(v)
        counter[v] += counter[i]
        
print(" ".join(map(str, counter)))