function Main(input) {
  const _input = input.split("\n");
  const treeCount = _input[0].split(' ')[0] - 0;
  const opeCount = _input[0].split(' ')[1] - 0;

  var trees = [];
  var operations = [];
  
  for (var i=1;i<(treeCount);i++) {
    trees.push({
      num: _input[i].split(' ')[0] - 0,
      parent: _input[i].split(' ')[1] - 0,
      score: 0
    });
  };

  for (var j=treeCount;j<treeCount+opeCount;j++) {
    operations.push({
      target: _input[j].split(' ')[0] - 0,
      counter: _input[j].split(' ')[1] - 0
    });
  };

  for(var i=0;i<operations.length;i++) {
    var _target = operations[i].target;
    var _counter = operations[i].counter;
    if (_target === 1) {
      trees = plusAllTrees(trees, _counter)
    }
  };

  console.log(trees.map((value) => value.score).join(' '));

  function searchParent() {
    var dependencies = [];
    return dependencies;
  };

  function plusAllTrees(trees, counter) {
    var _trees = trees;
    for (var i=0;i<_trees.length;i++) {
      _trees[i].score += counter;
    }
    return _trees;
  }
}

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