'use strict'

function Main(input) {
  const N = Number(input.split("\n")[0].split(" ")[0])
  const Q = Number(input.split("\n")[0].split(" ")[1])
  const abList = input.split("\n").slice(1, N).map(x => x.split(" ").map(x => Number(x)))
  const pxList = input.split("\n").slice(N).map(x => x.split(" ").map(x => Number(x)))
  
  const nodeList = []
  for(let i=0; i<N; i++) {
    nodeList.push(new Node(i+1))
  }
  for(let i=0; i<N-1; i++) {
    nodeList[abList[i][0]-1].addChild(nodeList[abList[i][1]-1])
  }

  for(let i=0; i<Q; i++) {
    nodeList[pxList[i][0]-1].addPoint(pxList[i][1])
  }

  for(let i=0; i<N; i++) {
    nodeList[i].addPointToChild()
  }

  let ans = ""
  for(let i=0; i<N; i++) {
    ans += nodeList[i].point + " "
  }
  console.log(ans.trim())
}

class Node {
  constructor(nodeName) {
    this.name = nodeName
    this.parent = null
    this.childrenArray = []
    this.point = 0
  }
  
  addChild(childNode) {
    this.childrenArray.push(childNode)
    childNode.parent = this
  }

  addPoint(point) {
    this.point += point
  }

  addPointToChild() {
    for(const child of this.childrenArray) {
      child.addPoint(this.point)
    }
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim())
