import java.util.Scanner

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n, q = sc.nextInt()

    val tree = new Array[mutable.Set[Int]](n)

    for (i <- tree.indices) {
      tree(i) = mutable.Set.empty
    }

    val vertex = new Array[Int](n)
    for (_ <- 0 until n - 1) {
      val a, b = sc.nextInt()
      tree(a - 1) += b - 1
    }

    for (_ <- 0 until q) {
      val p, x = sc.nextInt()
      vertex(p - 1) += x
    }

    val queue = mutable.Queue(0)

    while (queue.nonEmpty) {
      val i = queue.dequeue()
      tree(i).foreach(j => {
        vertex(j) += vertex(i)
        queue.enqueue(j)
      })
    }

    printArray(vertex)
  }

  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      if (i != arr.length - 1) {
        print(s"${arr(i)} ")
      }
    }
    println(arr(arr.length - 1))
  }
}