import java.util.*

fun main(args: Array<String>) {
    val (N, Q) = readLine()!!.split(" ").map { it.toInt() }
    val list = Array(N) { ArrayList<Int>() }
    repeat(N - 1) {
        val (ai, bi) = readLine()!!.split(" ").map { Integer.parseInt(it) }
        list[ai - 1].add(bi - 1)
        list[bi - 1].add(ai - 1)
    }
    val cost = Array(N) { 0 }
    repeat(Q) {
        val (pi, xi) = readLine()!!.split(" ").map { Integer.parseInt(it) }
        cost[pi - 1] += xi
    }
    val visited = Array(N) { false }
    val queue = ArrayDeque<Pair<Int, Int>>()
    visited[0] = true
    queue.add(0 to cost[0])
    while (queue.isNotEmpty()) {
        val (parent, parentCost) = queue.poll()
        for (child in list[parent]) {
            if (visited[child]) continue
            visited[child] = true
            cost[child] += parentCost
            queue.add(child to cost[child])
        }
    }
    println(cost.joinToString(" "))
}