output_description: Print the values of the counters on Vertex 1, 2, \ldots, N after all
  operations, in this order, with spaces in between.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N Q
      a_1 b_1
      :
      a_{N-1} b_{N-1}
      p_1 x_1
      :
      p_Q x_Q
attempt: from collections import deque  # pypyでも使える
  
  n, q = map(int, input().split())
  
  edges = [[] for i in range(n)]  # 枝がどことどこをつなぐかの情報を入れておく二次元配列
  for i in range(n - 1):
      a, b = map(lambda x: int(x) - 1, input().split())  # ラムダ式は必見
      # もっといい感じの書き方ないかな?
      edges[a].append(b)  # edges[a]には、ノードaの相方を格納
      edges[b].append(a)  # edges[b]には、ノードbの相方を格納する決まり
  
  # nodesの重さを格納
  nodes = [0] * n
  for i in range(q):
      p, x = map(int, input().split())
      nodes[p - 1] += x
  
  # oyakoを、親についての単調増加にしたい->デフォで先頭要素でのソートになるので安心
  # oyako.sort()
  # と思ったけどソートじゃ無理っぽい
  # 根から順に処理->bfs幅優先探索
  que = deque([0])
  color = [0] * n  # 全てのノードに対して、未探索の0を入れる
  color[0] = 0  # colorは親としての処理を終えたかどうかを入れる。終えたら1にする
  # TLEなった。二重ループはだめねえ。
  # ->oyako(edges)を、二次元配列にしてインデックスの数字を持つものをedges[i]に格納すれば
  while que:  # qが空でないのはこう表現できる
      i = que.popleft()
      if color[i] == 0:
          for edge in edges[i]:
              if color[edge] == 0:  # 相方が親じゃなければ(親ならすでに探索済みのはず)
                  nodes[edge] += nodes[i]
                  que.append(edge)
          color[i] = 1
  
  # 綺麗にかけそうでこの書き方をしたけど大丈夫かな?
  for node in nodes:
      print(node, end=" ")
  
problem_description: Statement
  
  Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1,
  and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i.
  
  Each of the vertices has a counter installed. Initially, the counters on all
  the vertices have the value 0.
  
  Now, the following Q operations will be performed:
  
    * Operation j (1 \leq j \leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.
  
  Find the value of the counter on each vertex after all operations.
samples: [{"input": "4 3\n    1 2\n    2 3\n    2 4\n    2 10\n    1 100\n    3 1", "output": "100 110 111 110\n    \n\nThe tree in this input is as follows:\n\n![Figure](https://img.atcoder.jp/ghi/c771b2231be06af79a9994cbe6867552.png)\n\nEach operation changes the values of the counters on the vertices as follows:\n\n  * Operation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n  * Operation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n  * Operation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\n* * *"}, {"input": "6 2\n    1 2\n    1 3\n    2 4\n    3 6\n    2 5\n    1 10\n    1 10", "output": "20 20 20 20 20 20"}]