object Main extends App {
  def dfs(root: Int, edges: Array[Array[Int]], visited: Array[Boolean], counters: Array[Long]): Unit = {
    if(visited(root) == false) {
      visited(root) = true
      val children = edges(root)
      children.foreach { c =>
        if (visited(c) == false) {
          counters(c) += counters(root)
          dfs(c, edges, visited, counters)
        }
      }
    }
  }

  val sc = new java.util.Scanner(System.in)

  val N, Q = sc.nextInt()
  var edges: Array[Array[Int]] = Array.fill(N+1)(Array())
  var operations: Array[(Int, Int)] = Array.fill(Q)((0, 0))
  var counters: Array[Long] = Array.fill(N+1)(0)

  (1 to N-1).foreach { _ =>
    val a, b = sc.nextInt()
    edges(a) = edges(a) ++ Array(b)
    edges(b) = edges(b) ++ Array(a)
  }

  (1 to Q).foreach{ q =>
    val p, x = sc.nextInt()
  	operations(q-1) = (p, x)
  }

  var visited = Array.fill(N+1)(false)

  operations.foreach{ case (p, x) =>
    counters(p) += x
  }

  dfs(1, edges, visited, counters)

  print(counters.drop(1).mkString(" "))
}