import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val N, Q = Integer.parseInt(sc.next)
    val G = Array.fill(N + 1)(ArrayBuffer[Int]())
    (0 until N - 1) foreach { _ =>
      val a, b = sc.nextInt()
      G(a).append(b)
      G(b).append(a)
    }

    val PtoX = Array.fill(N + 1)(0)
    (0 until Q).foreach(_ => PtoX(sc.nextInt) += sc.nextInt)

    val Counter = new Array[Long](N + 1)
    val visited = new Array[Boolean](N + 1)

    val stack = new scala.collection.mutable.Stack[Int]
    stack.push(1)
    while (stack.nonEmpty) {
      val u = stack.pop()
      visited(u) = true
      Counter(u) += PtoX(u)
      G(u).foreach { v =>
        if (!visited(v)) {
          stack.push(v)
          Counter(v) += Counter(u)
        }
      }
    }

    println(Counter.tail.mkString(" "))
  }
}
