import java.util.ArrayDeque

data class Edge(val to: Int)

fun main(args: Array<String>) {
    val (N, Q) = readLine()!!.split(" ").map {it.toInt()}

    var parent = IntArray(N)
    var points = LongArray(N)
    var neighbors = Array(N){ mutableListOf<Edge>()}
    repeat(N-1){
        val (a,b) = readLine()!!.split(" ").map { it.toInt() }
//        parent[b-1] = a-1
        neighbors[a-1].add(Edge(b-1))
        neighbors[b-1].add(Edge(a-1))
    }

    repeat(Q){
        val (p,x) = readLine()!!.split(" ").map { it.toInt() }
        points[p-1] = points[p-1]+ x
    }

    val queue = ArrayDeque<Int>(N)
    val seen = BooleanArray(N)

    queue.addLast(0)
    while (queue.isNotEmpty()){
        val current = queue.removeFirst()
        for(e in neighbors[current]){
            if(seen[e.to]){
                continue
            }
            points[e.to] += points[current]
            queue.addLast(e.to)
        }
        seen[current] = true

    }

    print(points.joinToString(" "))

}
