object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, Q = sc.nextInt()
    val G = Array.fill[List[Int]](N)(Nil)
    (0 until N - 1) foreach { _ =>
      val a, b = sc.nextInt()
      G(a-1) = b-1 :: G(a-1)
      G(b-1) = a-1 :: G(b-1)
    }
    val PtoX = scala.collection.mutable.Map[Int, Long]()
    (0 until Q). foreach { _ =>
      val p, x = sc.nextInt()
      PtoX.update(p-1, PtoX.getOrElse(p-1, 0L) + x)
    }

    // i番目の頂点のカウンタ, 訪れていなければ-1
    val Counter = Array.fill(N)(-1L)

    def solve(): Unit = {
      def dfs(u: Int, count: Long): Unit =
        if (Counter(u) < 0) {
          var thisCount = if (PtoX.contains(u)) PtoX(u) else 0
          Counter(u) = thisCount + count
          G(u) foreach { v =>
            dfs(v, count + thisCount)
          }
        }
      dfs(0, 0)
    }

    solve()

    println(Counter.mkString(" "))
  }

}
