#include <bits/stdc++.h>
using namespace std;
struct Node {
  int p, l, r;
};
Node t[200000];
int s[200000];
void init(int n) {
  for (int i = 0; i <= n; i++) {
    t[i].p = t[i].l = t[i].r = -1;
    s[i] = 0;
  }
}
void print(int i) {
  cout << i << " " << t[i].l << " " << t[i].r << " " << t[i].p << endl;
}
int main() {
  int n, q, a1, a2;
  int buf;
  cin >> n >> q;
  init(n);
  for (int i = 1; i <= n - 1; i++) {
    cin >> a1 >> a2;
    t[a2].p = a1;
    if (t[a1].l == -1) {
      t[a1].l = a2;
    } else {
      t[buf].r = a2;
    }
    buf = a2;
  }
  int p, x;
  for (int i = 0; i < q; i++) {
    cin >> p >> x;
    s[p] += x;
  }
  for (int i = 2; i <= n; i++) {
    s[i] += s[t[i].p];
  }
  for (int i = 1; i <= n; i++) {
    if (i != 1) {
      cout << " ";
    }
    cout << s[i];
  }
  cout << endl;
  return 0;
}
