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

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

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

    solve()

    println(Counter.mkString(" "))
  }

}
