import java.util.*

fun main(args: Array<String>) {

    val (N, Q) = readLine()!!.split(" ").map(String::toInt)

    val nodes = Array(N) { emptyArray<Int>() }
    val counter = Array(N) { 0 }
    val ans = Array(N) { 0 }
    val check = Array(N) { 0 }

    repeat(N - 1) {
        val (l, r) = readLine()!!.split(" ").map(String::toInt)
        nodes[l - 1] = nodes[l - 1].plus(r - 1)
        nodes[r - 1] = nodes[r - 1].plus(l - 1)
    }

    repeat(Q) {
        val (node, count) = readLine()!!.split(" ").map(String::toInt)
        counter[node - 1] += count
    }

    val stack = ArrayDeque<Pair<Int, Int>>()
    ans[0] = counter[0]
    stack.addAll(nodes[0].map { Pair(0, it) })
    check[0] = 1
    while (stack.isNotEmpty()) {
        val (parent, node) = stack.pop()
        if (check[node] == 1) {
            continue
        }
        counter[node] += counter[parent]
        ans[node] = counter[node]
        check[node] = 1
        stack.addAll(nodes[node].map { Pair(node, it) })
    }

    ans.joinToString(" ").let(::println)
}
