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];

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

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

  void calcCnt(int n, int parCnt) {
    cnt[n] += parCnt;
    foreach(c; tree[n]) {
      calcCnt(c, cnt[n]);
    }
  } 

  calcCnt(0, 0);

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