/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+:---test
4 3
1 2
2 3
2 4
2 10
1 100
3 1
---+/
/+---test
6 2
1 2
1 3
2 4
3 6
2 5
1 10
1 10
---+/

void main(string[] args) {
  long N, Q;
  readf(" %d %d ", &N, &Q);

  long[][] verts;
  verts.length = N;

  foreach (i; 0..N-1) {
    long a, b;
    readf(" %d %d ", &a, &b);
    --a;
    --b;
    verts[a] ~= b;
    verts[b] ~= a;
  }

  auto queries = new long[N];
  foreach (i; 0..Q) {
    long p, x;
    readf(" %d %d ", &p, &x);
    --p;
    queries[p] += x;
  }

  auto dp = new long[N];

  struct Item { long target, parent; }
  DList!Item queue;
  queue.insertBack(Item(0, -1));

  while (!queue.empty) {
    const front = queue.front;
    queue.removeFront();

    dp[front.target] = queries[front.target];
    if (front.parent >= 0) dp[front.target] += dp[front.parent];

    foreach (v; verts[front.target]) {
      if (v != front.parent) queue.insertBack(Item(v, front.target));
    }
  }

  foreach (i, v; dp) {
    if (i != 0) " ".write;
    v.write;
  }
  writeln;
}
