fun main(args: Array<String>) {
    val (n, q) = readLine()!!.split(" ").map(String::toInt)
    val nodes = Array(n) { Node() }
    for (i in 1.until(n)) {
        val (a, b) = readLine()!!.split(" ").map(String::toInt)
        nodes[b - 1].parent = nodes[a - 1]
    }
    for (i in 1..q) {
        val (p, x) = readLine()!!.split(" ").map(String::toInt)
        nodes[p - 1].num += x
    }

    nodes.forEach { it.addParent() }
    println(nodes.joinToString(" ") { String.format("%.0f", it.num) })
}

class Node () {
    var num: Double = 0.0
    var parent: Node? = null

    fun addParent() {
        if (this.parent != null) {
            this.num += this.parent!!.num
        }
    }
}