import java.util.*

fun main() {
    fun readIntList():List<Int>{return readLine()!!.split(" ").map { it.toInt() }}
    val (n,q)=readIntList()
    var g:MutableList<MutableSet<Int>> = MutableList(n+1){ mutableSetOf<Int>()}
    var ans: MutableList<Int> = MutableList(n+1){0}


    for (i in 1 until n){
        var (a,b)=readIntList()
        g[a].add(b)
        g[b].add(a)
    }
    for (i in 0 until q){
        var (p,x)=readIntList()
        ans[p]+=x
    }
    fun exe(g: MutableList<MutableSet<Int>>, i:Int, done: MutableSet<Int>, ans: MutableList<Int>, que: ArrayDeque<Int>){
        done.add(i)
        for (j in g[i]){
            if (!done.contains(j)){
                ans[j]+=ans[i]
                que.push(j)
            }
        }
    }
    var done: MutableSet<Int> = mutableSetOf(0)
    var que=ArrayDeque<Int>()
    que.push(1)
    while (!que.isEmpty()){
        exe(g,que.pop(),done, ans, que)
    }
    println(ans.slice(1 until ans.size).joinToString(" "))
}