import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val Q = sc.next().toInt()

        val to = Array(N + 2) { mutableListOf<Int>() }
        repeat(N - 1) {
            val a = sc.next().toInt()
            val b = sc.next().toInt()
            to[b].add(a)
            to[a].add(b)
        }

        val ans = LongArray(N + 2) { 0L }
        repeat(Q) {
            val p = sc.next().toInt()
            val x = sc.next().toLong()
            ans[p] += x
        }

        val q = LinkedList<Pair<Int, Int>>()
        q.addLast(Pair(1, 0))
        while (q.isNotEmpty()) {
            val item = q.pop()
            val v = item.first
            val p = item.second
            to[v].forEach { u ->
                if (u != p) {
                    ans[u] += ans[v]
                    q.addLast(Pair(u, v))
                }
            }
        }

        pw.println((1..N).map { ans[it] }.joinToString(" "))
    }
}
