import java.util.ArrayDeque

data class Edge<T>(val to: Int, var cost: T)

fun main(args: Array<String>) {
    val (n, q) = readIntegerList()
    val neighborList = Array(n) { mutableListOf<Edge<Int>>() }
    repeat(n - 1) {
        val (a, b) = readIntegerList()
        neighborList[a - 1].add(Edge(b - 1, 0))
        neighborList[b - 1].add(Edge(a - 1, 0))
    }

    val counter = Array(n) { 0 }
    repeat(q) {
        val (p, x) = readIntegerList()
        counter[p - 1] += x
    }

    val queue = ArrayDeque<Int>()
    val isChecked = BooleanArray(n) { false }
    queue.addLast(0)
    while (queue.isNotEmpty()) {
        val current = queue.removeFirst()
        for (edge in neighborList[current]) {
            if (isChecked[edge.to] == false) {
                counter[edge.to] += counter[current]
                queue.addLast(edge.to)
            }
        }

        isChecked[current] = true
    }

    println(counter.joinToString(" "))
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
