import scala.annotation.tailrec

object Main extends App {
  val sc = new java.util.Scanner(System.in)

  val N, Q = sc.nextInt()
  var edges: Array[Array[Int]] = Array.fill(N+1)(Array())
  var counters: Array[Long] = Array.fill(N+1)(0)

  (1 to N-1).foreach { _ =>
    val a, b = sc.nextInt()
    edges(a) = edges(a) ++ Array(b)
    edges(b) = edges(b) ++ Array(a)
  }

  (1 to Q).foreach{ q =>
    val p, x = sc.nextInt()
    counters(p) += x
  }
  
  def dfs(root: Int): Unit = {
    val stack = new scala.collection.mutable.Stack[Int]
    var visited = Array.fill(N+1)(false)
    var count = counters(root)
    visited(root) = true
    stack.push(root)
    while(!stack.isEmpty) {
      val v = stack.pop()
      count = counters(v)

      val children = edges(v)
      children.foreach{ c =>
        if(visited(c) == false) {
          visited(c) = true
          counters(c) += count
          stack.push(c)
        }
      }
    }
  }
  dfs(1)

  print(counters.drop(1).mkString(" "))
}