const main = (input) => {
  var N = input[0].split(" ")[0]-0;
  var Q = input[0].split(" ")[1]-0;

  var nodes = {};
  for(var i=1;i<=N;i++){
    nodes[i]={score:0, next:[]};
  }
  for(var i=1;i<N;i++){
    var a = input[i].split(" ")[0]-0;
    var b = input[i].split(" ")[1]-0;
    nodes[a].next.push(b);
  }
  for(var i=N;i<input.length;i++){
    var p = input[i].split(" ")[0]-0;
    var x = input[i].split(" ")[1]-0;
    nodes[p].score += x;
  }
  var stack = [nodes[1]];

  while(stack.length != 0){
    var now = stack.pop();
    for(var i=0;i<now.next.length;i++){
      var next = nodes[now.next[i]];
      next.score += now.score;
      stack.push(next);
    }
  }
  var ans = [];
  for(var i=1;i<=N;i++){
    ans.push(nodes[i].score);
  }
  console.log(ans.join(" "));
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
