import scala.collection.mutable
import scala.collection.mutable.{Stack, Queue}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}

object Main{
  def main(args: Array[String]) ={
    val arr1 = io.StdIn.readLine().split(' ')
    val N = arr1(0).toInt
    val Q = arr1(1).toInt
    val cTree = mutable.HashMap.empty[Int, ListBuffer[Int]]
    val vTree = mutable.HashMap.empty[Int, Long]

    (0 until N - 1).foreach {
      i =>
        val arr = io.StdIn.readLine().split(' ')
        val (a, b) = (arr(0).toInt, arr(1).toInt)

        if (cTree.contains(a)) {
          val arr = cTree(a)
          arr.append(b)
          vTree.update(b, 0L)
          cTree(a) = arr
        } else {
          vTree.update(a, 0L)
          vTree.update(b, 0L)
          cTree.update(a, ListBuffer(b))
        }
    }

    (0 until Q).foreach {
      i =>
        val arr = io.StdIn.readLine().split(' ')
        val (p, x) = (arr(0).toInt, arr(1).toLong)
        vTree(p) += x
    }

    var s = new mutable.Stack[Int]
    s.push(1) // rootをプッシュ

    while (s.nonEmpty) {
      var p = s.pop()
      val list = cTree(p)

      list.foreach {
        pi =>
          if (cTree.contains(pi)) {
            // 次が根ノードなら
            s.push(pi)
            vTree(pi) += vTree(p)
          } else {
            // 次が葉ノードなら
            vTree(pi) += vTree(p)
          }
      }

    }

    val len = vTree.size
    (1 to len).foreach{
      i => print(vTree(i) + " ")
    }
  }
}