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(' ')
        var (p, x) = (arr(0).toInt, arr(1).toLong)

        var s = new mutable.Stack[Int]
        s.push(p)

        // 根ノードに対する処理
        if(cTree.contains(p)) {
          while (s.nonEmpty) {
            p = s.pop()
            vTree(p) += x

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

    }

    vTree.toSeq.sortBy(_._1).foreach(i => println(i._2))
  }
}