import scala.collection.mutable

object Main extends App {
  import scala.io.StdIn._
  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)
  val nodes = Array.fill(n){Nil: List[Int]}
  for (_ ← 1 until n) {
    val Array(a, b) = readLine.trim.split(' ').map(_.toInt - 1)
    nodes(a) ::= b
    nodes(b) ::= a
  }
  val additional = Array.fill(n){0}
  for (_ ← 0 until q) {
    val Array(p, x) = readLine.trim.split(' ').map(_.toInt)
    additional(p - 1) += x
  }
  val queue = mutable.Queue[Int](0)
  val isVisited = Array.fill(n){false}
  while (queue.nonEmpty) {
    val top = queue.dequeue()
    isVisited(top) = true
    for (next ← nodes(top) if !isVisited(next)) {
      additional(next) += additional(top)
      queue.enqueue(next)
    }
  }
  println(additional.mkString(" "))
}