N, Q = list(map(int, input().split()))

graph = [[] for i in range(200010)]

ans = [0 for i in range(200010)]

import sys

#sys.setrecursionlimit(100000)

sys.setrecursionlimit(10**7)

#

readline = sys.stdin.readline





for _ in range(N - 1):

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

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

    a -= 1

    b -= 1



    graph[a].append(b)

    graph[b].append(a)



for _ in range(Q):

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

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

    p -= 1



    ans[p] += x



def dfs(node, frm=-1):

    for to in graph[node]:

        if to == frm:

            continue

        ans[to] += ans[node]

        dfs(to, node)

dfs(0)



print((*ans[:N]))
def main():

  N, Q = list(map(int, input().split()))

  graph = [[] for i in range(200010)]

  ans = [0 for i in range(200010)]

  import sys

  #sys.setrecursionlimit(100000)

  sys.setrecursionlimit(10**7)

  #

  readline = sys.stdin.readline





  for _ in range(N - 1):

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

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

      a -= 1

      b -= 1



      graph[a].append(b)

      graph[b].append(a)



  for _ in range(Q):

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

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

      p -= 1



      ans[p] += x



  def dfs(node, frm=-1):

      for to in graph[node]:

          if to == frm:

              continue

          ans[to] += ans[node]

          dfs(to, node)

  dfs(0)



  print((*ans[:N]))



if __name__ == '__main__':

  main()
N, Q = list(map(int, input().split()))
graph = [[] for i in range(200010)]
ans = [0 for i in range(200010)]
import sys

# sys.setrecursionlimit(100000)
sys.setrecursionlimit(10**7)
#
readline = sys.stdin.readline
for _ in range(N - 1):
    # a, b = map(int, input().split())
    a, b = list(map(int, readline().split()))
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
for _ in range(Q):
    # p, x = map(int, input().split())
    p, x = list(map(int, readline().split()))
    p -= 1
    ans[p] += x


def dfs(node, frm=-1):
    for to in graph[node]:
        if to == frm:
            continue
        ans[to] += ans[node]
        dfs(to, node)


dfs(0)
print((*ans[:N]))

def main():
    N, Q = list(map(int, input().split()))
    graph = [[] for i in range(200010)]
    ans = [0 for i in range(200010)]
    import sys

    # sys.setrecursionlimit(100000)
    sys.setrecursionlimit(10**7)
    #
    readline = sys.stdin.readline
    for _ in range(N - 1):
        # a, b = map(int, input().split())
        a, b = list(map(int, readline().split()))
        a -= 1
        b -= 1
        graph[a].append(b)
        graph[b].append(a)
    for _ in range(Q):
        # p, x = map(int, input().split())
        p, x = list(map(int, readline().split()))
        p -= 1
        ans[p] += x

    def dfs(node, frm=-1):
        for to in graph[node]:
            if to == frm:
                continue
            ans[to] += ans[node]
            dfs(to, node)

    dfs(0)
    print((*ans[:N]))


if __name__ == "__main__":
    main()

-N, Q = list(map(int, input().split())) -graph = [[] for i in range(200010)] -ans = [0 for i in range(200010)] -import sys +def main(): +    N, Q = list(map(int, input().split())) +    graph = [[] for i in range(200010)] +    ans = [0 for i in range(200010)] +    import sys -# sys.setrecursionlimit(100000) -sys.setrecursionlimit(10**7) -# -readline = sys.stdin.readline -for _ in range(N - 1): -    # a, b = map(int, input().split()) -    a, b = list(map(int, readline().split())) -    a -= 1 -    b -= 1 -    graph[a].append(b) -    graph[b].append(a) -for _ in range(Q): -    # p, x = map(int, input().split()) -    p, x = list(map(int, readline().split())) -    p -= 1 -    ans[p] += x +    # sys.setrecursionlimit(100000) +    sys.setrecursionlimit(10**7) +    # +    readline = sys.stdin.readline +    for _ in range(N - 1): +        # a, b = map(int, input().split()) +        a, b = list(map(int, readline().split())) +        a -= 1 +        b -= 1 +        graph[a].append(b) +        graph[b].append(a) +    for _ in range(Q): +        # p, x = map(int, input().split()) +        p, x = list(map(int, readline().split())) +        p -= 1 +        ans[p] += x + +    def dfs(node, frm=-1): +        for to in graph[node]: +            if to == frm: +                continue +            ans[to] += ans[node] +            dfs(to, node) + +    dfs(0) +    print((*ans[:N])) -def dfs(node, frm=-1): -    for to in graph[node]: -        if to == frm: -            continue -        ans[to] += ans[node] -        dfs(to, node) - - -dfs(0) -print((*ans[:N])) +if __name__ == "__main__": +    main()