import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n, q = sc.nextInt
    val to = Array.fill[ArrayBuffer[Int]](n)(ArrayBuffer.empty[Int])

    for (i <- 0 until n - 1) {
      val a = sc.nextInt - 1
      val b = sc.nextInt - 1
      to(a).+=(b)
    }

    val ans = Array.fill[Int](n)(0)
    for (i <- 0 until q) {
      val p = sc.nextInt - 1
      val x = sc.nextInt
      ans(p) += x
    }

    def dfs(v: Int): Unit = {
      for (u <- to(v)) {
        ans(u) += ans(v)
        dfs(u)
      }
    }

    dfs(0)

    val pw = new java.io.PrintWriter(System.out)
    for (i <- 0 until n) {
      pw.println(ans(i))
      if (i % 10000 == 0) pw.flush
    }
    pw.flush
  }
}
