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

    val parent = IntArray(N)
    val ans = IntArray(N)

    repeat(N - 1) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        parent[b - 1] = a - 1
    }

    repeat(Q) {
        val (p, x) = readLine()!!.split(" ").map { it.toInt() }
        ans[p - 1] += x
    }

    for(i in 1 until N) {
        ans[i] += ans[parent[i]]
    }

    println(ans.joinToString(" "))
}