import java.util.*
import kotlin.collections.ArrayDeque
import kotlin.collections.HashSet

fun main(args: Array<String>){

    var (N,Q) = readLine()!!.split(" ").map{it.toInt()}
    var ans = LongArray(N){0}
    var checked = BooleanArray(N){false}
    var connectSet = Array(N){HashSet<Int>()}

    for(i in 1 until N){
        var(a,b) = readLine()!!.split(" ").map{it.toInt()}
        connectSet[a-1].add(b-1)
        connectSet[b-1].add(a-1)
    }

    for(i in 0 until Q){
        var (p,x) = readLine()!!.split(" ").map{it.toInt()}
        ans[p-1] = ans[p-1] + x
    }

    var queue: Queue<Int> = LinkedList<Int>()

    queue.add(0)
    checked[0] = true

    while(queue.peek() != null){
        var n = queue.poll()

        connectSet[n].forEach { i ->
            if(!checked[i]){
                ans[i] += ans[n]
                checked[i] = true
                queue.add(i)
            }
        }
    }

    for(i in ans.indices){
        print("${ans[i]} ")
    }



}