'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);
    ki[b].push(a);
  }
  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], done = Array(N).fill(false);
  let i = 0;
  done[1] = true;
  do {
    let q = queue[i++];
    for ( let child of ki[q] ) {
      if ( done[child] ) continue;
      counter[child] += counter[q];
      queue.push(child);
      done[child] = true;
    };
  } while( i < N );
  return counter.slice(1).join(' ');
}(require('fs').readFileSync('/dev/stdin', 'utf8')));