fun main(args: Array<String>) {
    val (n, q) = readLine()!!.split(" ").map { it.toInt() }

    // 木を上からたどって足して行けばおしまいでは？？
    val c = Array(n) { mutableListOf<Int>() }

    // O(N)
    for (i in 0 until n - 1) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        c[a - 1].add(b - 1)
    }

    // O(Q)
    val point = IntArray(n)
    for (i in 0 until q) {
        val (p, x) = readLine()!!.split(" ").map { it.toInt() }
        point[p - 1] += x
    }

    // ルートから深さ優先探索で値を付与
    // O(N)
    val score = LongArray(n)
    fun scoring(index: Int, nowS: Long) {

        val nowS_next = nowS + point[index]

        score[index] = nowS_next

        for (n in c[index]) {
            scoring(n, nowS_next)
        }

        return
    }

    scoring(0, 0L)

    println(score.joinToString(" "))
}