n, q = map(int, input().split())
d = {}
v = {}
for _ in range(n - 1):
    a, b = input().split()
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
    if b not in d:
        d[b] = []

for key in d.keys():
    v[key] = 0

for _ in range(q):
    node, increment = input().split()
    queue = [node]
    all_childs = [node]
    while len(queue) > 0:
        el = queue.pop()
        if el not in all_childs:
            all_childs.append(el)
        childs = d[el]
        if len(childs) > 0:
            queue.extend(d[el])
    for child in all_childs:
        v[child] += int(increment)

for value in v.values():
    print(value, end=' ')
print('')