import java.util.Stack

fun main(args: Array<String>) {
    val (n, q) = readLine()!!.split(" ").map(String::toInt)
    val g = run {
        val g = Array<MutableList<Int>>(n + 1) { mutableListOf() }
        repeat(n - 1) {
            val (a, b) = readLine()!!.split(" ").map(String::toInt)
            g[a].add(b)
            g[b].add(a)
        }
        g
    }

    val result = Array<Int>(n + 1) { 0 }

    repeat(q) {
        val (p, x) = readLine()!!.split(" ").map(String::toInt)
        result[p] += x
    }

    val stack = Stack<Int>()
    val isDone = Array<Boolean>(n + 1) { false }
    stack.add(1)

    while (stack.isNotEmpty()) {
        val node = stack.pop()
        isDone[node] = true

        for (child in g[node]) {
            if (!isDone[child]) {
                result[child] += result[node]
                stack.push(child)
            }
        }
    }

    for (i in 1 until g.size) {
        print("${result[i]} ")
    }
}