#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
void add_counter(vector<pair<vector<int>, int>> &tree, int p) {
  if (tree.at(p).first.size() == 0) return;
  for (int &ci : tree.at(p).first) {
    tree.at(ci).second += tree.at(p).second;
    add_counter(tree, ci);
  }
  return;
}
void solve() {
  int N, Q;
  cin >> N >> Q;
  vector<int> a(N - 1, 0), b(N - 1, 0), p(Q), x(Q), c(N, 0);
  for (int i = 0; i < N - 1; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  for (int i = 0; i < Q; i++) {
    cin >> p.at(i) >> x.at(i);
  }
  vector<vector<int>> children(N);
  vector<pair<vector<int>, int>> tree(N);
  for (int i = 0; i < N; i++) tree.at(i).second = 0;
  for (int i = 0; i < N - 1; i++) {
    if (a.at(i) < b.at(i)) {
      tree.at(a.at(i) - 1).first.push_back(b.at(i) - 1);
    } else {
      tree.at(b.at(i) - 1).first.push_back(a.at(i) - 1);
    }
  }
  for (int i = 0; i < Q; i++) {
    tree.at(p.at(i) - 1).second += x.at(i);
  }
  add_counter(tree, 0);
  for (int i = 0; i < N; i++) cout << tree.at(i).second << endl;
}
signed main() { solve(); }
