import sys

sys.setrecursionlimit(1000000)

def main():

  _map = map

  _input = input

  _int = int

  def calc_results(results, pvalue, i):

    results[i] = pvalue + values[i]

    for j in childrens[i]:

      calc_results(results, results[i], j)

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

  values = [0] * (n + 1)

  results = [0] * (n + 1)

  childrens = [[] for _ in range(n + 1)]

  for i in range(n - 1):

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

    childrens[a].append(b)

  for _ in range(q):

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

    values[p] += x

  calc_results(results, 0, 1)

  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)]))

import sys

sys.setrecursionlimit(1000000)


def main():
    _map = map
    _input = input
    _int = int

    def calc_results(results, pvalue, i):
        results[i] = pvalue + values[i]
        for j in childrens[i]:
            calc_results(results, results[i], j)

    n, q = _map(_int, _input().split())
    values = [0] * (n + 1)
    results = [0] * (n + 1)
    childrens = [[] for _ in range(n + 1)]
    for i in range(n - 1):
        a, b = _map(_int, _input().split())
        childrens[a].append(b)
    for _ in range(q):
        p, x = _map(_int, _input().split())
        values[p] += x
    calc_results(results, 0, 1)
    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)]))

-import sys - -sys.setrecursionlimit(1000000) - - -def main(): -    _map = map -    _input = input -    _int = int - -    def calc_results(results, pvalue, i): -        results[i] = pvalue + values[i] -        for j in childrens[i]: -            calc_results(results, results[i], j) - -    n, q = _map(_int, _input().split()) -    values = [0] * (n + 1) -    results = [0] * (n + 1) -    childrens = [[] for _ in range(n + 1)] -    for i in range(n - 1): -        a, b = _map(_int, _input().split()) -        childrens[a].append(b) -    for _ in range(q): -        p, x = _map(_int, _input().split()) -        values[p] += x -    calc_results(results, 0, 1) -    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)]))