import java.util.*

fun main(args: Array<String>) {
    val (N, Q) = readLine()!!.split(" ").map { it.toInt() }
    val list = Array(N) { ArrayList<Int>() }
    repeat(N - 1) {
        val (ai, bi) = readLine()!!.split(" ").map { Integer.parseInt(it) }
        list[ai - 1].add(bi - 1)
        list[bi - 1].add(ai - 1)
    }
    val dist = Array(N) { -1 }
    val oya = Array(N) { -1 }
    val ko = Array(N) { ArrayList<Int>() }
    val pq = ArrayDeque<Int>()
    dist[0] = 0
    pq.add(0)
    while (pq.isNotEmpty()) {
        val node = pq.poll()
        for (v in list[node]) {
            if (dist[v] != -1) continue
            dist[v] = dist[node] + 1
            pq.add(v)
            oya[v] = node
            ko[node].add(v)
        }
    }

    val cost: Array<Int> = Array(N) { 0 }
    repeat(Q) {
        val (pi, xi) = readLine()!!.split(" ").map { Integer.parseInt(it) }
        cost[pi - 1] += xi
    }

    val pq2 = ArrayDeque<Node>()
    pq2.add(Node(0, cost[0]))
    while (pq2.isNotEmpty()) {
        val v = pq2.poll()
        ko[v.id].forEach {
            cost[it] += v.cost
            pq2.add(Node(it, cost[it]))
        }
    }
    println(cost.joinToString(" "))
}

data class Node(val id: Int, val cost: Int)