object Main {

  import scala.collection.mutable.ArrayBuffer

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

    val N, Q = sc.nextInt()
    val G = Array.fill(N+1)(ArrayBuffer[Int]())
    (0 until N - 1) foreach { _ =>
      val a, b = sc.nextInt()
      G(a).append(b)
      G(b).append(a)
    }
    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 = new Array[Long](N+1)

    val visited = new Array[Boolean](N+1)

    val stack = new scala.collection.mutable.Stack[Int]
    stack.push(1)
    while (stack.nonEmpty) {
      val u = stack.pop()
      visited(u) = true
      val thisCount = if (PtoX.contains(u)) PtoX(u) else 0L
      Counter(u) += thisCount
      G(u).foreach { v =>
        if (!visited(v)) {
          stack.push(v)
          Counter(v) += Counter(u)
        }
      }
    }

    println(Counter.tail.mkString(" "))
  }

}
