function Main(input) {
  "use strict"
  const temp = input.split("\n")

  const nq = temp.shift().split(" ");
  const n = parseInt(nq.shift());
  const q = parseInt(nq.shift());

  const sides = temp.slice(0,n-1).map(str => str.split(" ").map(e => parseInt(e)))
  const operations = temp.slice(n-1, n+q-1).map(str => str.split(" ").map(e => parseInt(e)))

  const tree = [];
  const answer = [];
  for(let i = 0; i <= n; i++){
    tree.push([]);
    answer.push(0);
  }
  sides.forEach(side => {
    tree[side[0]].push(side[1])
  });

  
  function recursiveAdder(root, num){
    answer[root] += num;
    tree[root].forEach(child => {
      recursiveAdder(child, num);
    })
  }
  operations.forEach(ope => recursiveAdder.apply(this, ope))
  answer.shift();
  console.log(answer.join(" "));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
