import java.util.*

fun main(args : Array<String>) {
    val (n, q) = readLine()!!.split(" ").map { it.toInt() }
    val nodes = Array(n) { mutableListOf<Int>() }
    val scores = LongArray(n) { 0L }
    val counters = LongArray(n) { 0L }

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

    repeat(q) {
        val (p, x) = readLine()!!.split(" ").map { it.toInt() }
        scores[p-1] += x + 0L
        counters[p-1] += x + 0L
    }

    val stack = Stack<Int>()
    val seen = Array(n){ false }
    stack.add(0)

    while (stack.isNotEmpty()) {
        val idx = stack.pop()
        seen[idx] = true

        nodes[idx].forEach {
            if (!seen[it]) {
                stack.push(it)
                counters[it] += counters[idx]
            }
        }
    }

    println(counters.joinToString(separator = " "))
}