#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  int t, v;
  queue<pair<int, int>> a;
  pair<int, int> tmp;
  long long c[200001];
  cin >> N >> Q;
  memset(c, 0, sizeof(c));
  for (int i = 1; i < N; i++) {
    cin >> t >> v;
    a.push(pair<int, int>(t, v));
  }
  for (int i = 0; i < Q; i++) {
    cin >> t >> v;
    c[t] += v;
  }
  while (!a.empty()) {
    tmp = a.front();
    a.pop();
    c[tmp.second] += c[tmp.first];
  }
  for (int i = 1; i <= N; i++) {
    if (i < N) {
      cout << c[i] << " ";
    } else {
      cout << c[i];
    }
  }
  return 0;
}
