import java.util.*

fun main(args: Array<String>) {

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

    val nodes = Array(N) { ArrayDeque<Int>() }
    val counter = IntArray(N)
    val ans = IntArray(N)
    val check = BooleanArray(N)

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

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

//    nodes.forEachIndexed { i, n ->
//        println("$i:${n.joinToString(",")}")
//    }
//    counter.forEach(::println)

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

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