'use strict';

function main(stdin) {
  function walk(target, v) {
    c[target] += v;
    if (g[target].length === 0) return;
    else g[target].forEach(c => walk(c, v));
  }

  const input = stdin.split('\n');
  const NQ = input.shift().split(' ').map(v => parseInt(v, 10));
  const N = NQ[0];
  const Q = NQ[1];
  const gragh = input.splice(0, N - 1).map(v => v.split(' ').map(w => parseInt(w, 10)));
  const query = input.map(v => v.split(' ').map(w => parseInt(w, 10)));

  const c = [];
  const g = [];
  for (let i = 0; i < N; ++i) {
    c[i] = 0;
    g[i] = [];
  }

  gragh.forEach(node => {
    g[node[0] - 1].push(node[1] - 1);
  });

  query.forEach(q => walk(q[0] - 1, q[1]));
  
  console.log(c.join(' '));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());