'use strict';
console.log(function(args){
  const tmp = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  const N = tmp[0][0], Q = tmp[0][1];
  const ki = Array(N+1).fill(0).map(_=>[]);
  for ( let i = 0; i < N-1; i++ ) {
    const a = tmp[i+1][0];
    const b = tmp[i+1][1];
    ki[a].push(b);
  }
  const counter = Array(N+1).fill(0);
  for ( let j = 0; j < Q; j++ ) {
    const p = tmp[j+N][0];
    const x = tmp[j+N][1];
    counter[p] += x;
  }
  const queue = [1];
  while( queue[0] ) {
    let q = queue.shift();
    for ( let eda of ki[q] ) {
      counter[eda] += counter[q];
      queue.push(eda);
    }
  }
  return counter.slice(1).join(' ');
}(require('fs').readFileSync('/dev/stdin', 'utf8')));