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

  val N, Q = sc.nextInt()
  var nodes: Map[Int, Int] = Array().toMap
  var operations: Array[(Int, Int)] = Array.fill(Q)((0, 0))
  var counters = Array.fill(N)(0)

  (1 to N-1).foreach { _ =>
    val p, c = sc.nextInt()
    nodes = nodes ++ Map(c -> p)
  }

  (1 to Q).foreach{ q =>
    val p, x = sc.nextInt()
  	operations(q-1) = (p, x)
  }

  operations.foreach{ case (p, x) =>
    counters(p-1) += x
  }

  (2 to N).foreach { c =>
    val p = nodes.get(c)
    if (p.isDefined) {
      counters(c - 1) += counters(p.get - 1)
    }
  }

  print(counters.mkString(" "))
}