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

struct Node {
  int[] children;
  int dp;
  int cnt;
}

void main() {
  auto input = readln.split.to!(int[]);
  auto N = input[0], Q = input[1];
  auto tree = new Node[N];
  foreach(i; 0..(N-1)) {
    input = readln.split.to!(int[]);
    auto a = input[0], b = input[1];
    if (a >= b) swap(a, b);
    tree[a-1].children ~= b-1;
  }

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

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

  calcCnt(0, 0);

  foreach(i; 0..N) {
    write(tree[i].cnt, " ");
  }
  writeln;
}
