import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array, std.functional;

void main() {
  auto input = readln.split.to!(int[]);
  auto N = input[0], Q = input[1];
  auto tree = new int[][N];
  auto cnt = new int[N];

  foreach(i; 0..(N-1)) {
    input = readln.split.to!(int[]);
    auto a = input[0], b = input[1];
    tree[a-1] ~= b-1;
    tree[b-1] ~= a-1;
  }

  foreach(i; 0..Q) {
    input = readln.split.to!(int[]);
    auto p = input[0], x = input[1];
    cnt[p-1] += x;
  }

  auto seen = new bool[N];
  void dfs(int n, int parCnt) {
    seen[n] = true;
    cnt[n] += parCnt;
    foreach(c; tree[n]) {
      if(!seen[c]) {
        dfs(c, cnt[n]);
      }
    }
  } 

  dfs(0, 0);

  foreach(c; cnt) {
    write(c, " ");
  }
}
