#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int Q;
  cin >> N;
  cin >> Q;
  vector<int> eda(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    eda.at(b - 1) = a - 1;
  }
  vector<int> answer(N, 0);
  for (int i = 0; i < Q; i++) {
    int p;
    int x;
    cin >> p >> x;
    answer.at(p - 1) += x;
  }
  for (int i = 1; i < N; i++) {
    answer.at(i) += answer.at(eda.at(i));
  }
  for (int i = 0; i < N; i++) {
    cout << answer.at(i) << endl;
  }
}
