object Main extends App {
  def findChildren(root: Int, nodes: Array[(Int, Int)]) : Array[Int] = {
    var children: Array[Int] = Array()
    val subNodes = nodes.filter{case(a, _) => a>root}
    nodes.foreach{ case (x, y) =>
      if (x == root) {
        val thisChildren = findChildren(y, subNodes)
        children = children ++ thisChildren
      }
    }
    return children ++ Array(root)
  }
  val sc = new java.util.Scanner(System.in)

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

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

  (1 to Q).foreach{ _ =>
    val p, x = sc.nextInt
  	operations = operations ++ Array((p, x))
  }

  val parToChildren = (1 to N).map{ p =>
    p -> findChildren(p, nodes)
  }.toMap

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

  (1 to N).reverse.foreach { p =>
    val children = parToChildren(p)
    children.filter(_ != p).foreach { c =>
      counters(c-1) += counters(p-1)
    }
  }

  print(counters.mkString(" "))
}