import java.util.ArrayDeque
import kotlin.Comparator
import kotlin.String

fun main(args: Array<String>) {
    val (n, q) = readIntList()

    val tree = List(n) { mutableSetOf<Int>() }
    repeat(n - 1) {
        val (a, b) = readIntList()
        tree[a - 1].add(b - 1)
        tree[b - 1].add(a - 1)
    }

    val cnt = MutableList(n) { 0 }
    repeat(q) {
        val (p, x) = readIntList()
        cnt[p - 1] += x
    }

    val queue = ArrayDeque<Int>()
    queue.addLast(0)
    val visited = MutableList(n) { false }
    while (!queue.isEmpty()) {
        val node = queue.removeLast()
        visited[node] = true
        tree[node].forEach {
            if (!visited[it]) {
                cnt[it] += cnt[node]
                queue.addLast(it)
            }
        }
    }

    val ans = StringBuilder()
    ans.append(cnt[0])
    for (i in 1 until n) {
        ans.append(" ${cnt[i]}")
    }
    println(ans.toString())
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
