import java.util.*

class Node(val depth: Int, val index: Int, val parent: Int) : Comparable<Node> {
    override fun compareTo(other: Node): Int {
        return this.depth - other.depth
    }

}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val q = scanner.nextInt()

    val children = Array(n + 1) { mutableListOf<Int>() }
    (1 until n).forEach {
        val a = Integer.parseInt(scanner.next())
        val b = Integer.parseInt(scanner.next())
        children[a].add(b)
        children[b].add(a)
    }

    val count = LongArray(n + 1) { 0 }
    (1..q).forEach {
        val p = Integer.parseInt(scanner.next())
        val x = Integer.parseInt(scanner.next())
        count[p] = count[p] + x
    }


    val pq = PriorityQueue<Node>()
    pq.add(Node(1, 1, 0))
    val visited = BooleanArray(n + 1) { false }
    while (pq.isNotEmpty()) {
        val node = pq.poll()
        if (visited[node.index]) continue

        visited[node.index] = true
        count[node.index] = count[node.index] + count[node.parent]

        children[node.index].forEach { child ->
            if (visited[child]) return@forEach
            pq.add(Node(node.depth + 1, child, node.index))
        }
    }

    val sb = StringBuilder()
    for (i in 1 until n) {
        sb.append(count[i])
        sb.append(" ")
    }
    sb.append(count[n])
    println(sb)
}

