import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;

int[][] tree;
int[] nodes(int nodeNum) {
  int[] all = [nodeNum];
  foreach(next; tree[nodeNum]) {
    all ~= nodes(next);
  }
  return all;
}

void main() {
  int N, Q; readf("%d %d\n", &N, &Q);

  tree.length = N;
  foreach(i; 0..N-1) {
    int from, to; readf("%d %d\n", &from, &to);
    tree[from - 1] ~= to - 1;
  }

  int[][] subNodes;
  subNodes.length = N;
  foreach(i; 0..N) {
    subNodes[i] = nodes(i);
  }
  // writeln(subNodes);
  
  int[] counters = new int[N];
  foreach(i; 0..Q) {
    int node, increments; readf("%d %d\n", &node, &increments);
    counters[node-1] += increments;
  }

  int[] totals = new int[N];

  totals.to!(string[]).join(" ").writeln;
}
