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
    }

//    cTree.foreach {
//      case (r, l) =>
        var s = new mutable.Stack[Int]
        s.push(1)

        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)
              }
          }
//        }

    }

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