n, q = list(map(int, input().split()))

values = [0] * (n + 1)

parents = [0] * (n + 1)

results = [0] * (n + 1)

for i in range(n - 1):

  a, b = list(map(int, input().split()))

  parents[b] = a

for _ in range(q):

  p, x = list(map(int, input().split()))

  values[p] += x

for i in range(1, n + 1):

  results[i] = values[i]

  if parents[i] != 0:

    results[i] += results[parents[i]]

print((*[results[i] for i in range(1, n + 1)]))

def main():

  _map = map

  _range = range

  _int = int

  n, q = _map(_int, input().split())

  values = [0] * (n + 1)

  parents = [0] * (n + 1)

  results = [0] * (n + 1)

  for i in _range(n - 1):

    a, b = _map(_int, input().split())

    parents[b] = a

  for _ in _range(q):

    p, x = _map(_int, input().split())

    values[p] += x

  for i in _range(1, n + 1):

    results[i] = values[i]

    if parents[i] != 0:

      results[i] += results[parents[i]]

  print((*[results[i] for i in range(1, n + 1)]))

main()

n, q = list(map(int, input().split()))
values = [0] * (n + 1)
parents = [0] * (n + 1)
results = [0] * (n + 1)
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    parents[b] = a
for _ in range(q):
    p, x = list(map(int, input().split()))
    values[p] += x
for i in range(1, n + 1):
    results[i] = values[i]
    if parents[i] != 0:
        results[i] += results[parents[i]]
print((*[results[i] for i in range(1, n + 1)]))

def main():
    _map = map
    _range = range
    _int = int
    n, q = _map(_int, input().split())
    values = [0] * (n + 1)
    parents = [0] * (n + 1)
    results = [0] * (n + 1)
    for i in _range(n - 1):
        a, b = _map(_int, input().split())
        parents[b] = a
    for _ in _range(q):
        p, x = _map(_int, input().split())
        values[p] += x
    for i in _range(1, n + 1):
        results[i] = values[i]
        if parents[i] != 0:
            results[i] += results[parents[i]]
    print((*[results[i] for i in range(1, n + 1)]))


main()

-n, q = list(map(int, input().split())) -values = [0] * (n + 1) -parents = [0] * (n + 1) -results = [0] * (n + 1) -for i in range(n - 1): -    a, b = list(map(int, input().split())) -    parents[b] = a -for _ in range(q): -    p, x = list(map(int, input().split())) -    values[p] += x -for i in range(1, n + 1): -    results[i] = values[i] -    if parents[i] != 0: -        results[i] += results[parents[i]] -print((*[results[i] for i in range(1, n + 1)])) +def main(): +    _map = map +    _range = range +    _int = int +    n, q = _map(_int, input().split()) +    values = [0] * (n + 1) +    parents = [0] * (n + 1) +    results = [0] * (n + 1) +    for i in _range(n - 1): +        a, b = _map(_int, input().split()) +        parents[b] = a +    for _ in _range(q): +        p, x = _map(_int, input().split()) +        values[p] += x +    for i in _range(1, n + 1): +        results[i] = values[i] +        if parents[i] != 0: +            results[i] += results[parents[i]] +    print((*[results[i] for i in range(1, n + 1)])) + + +main()