#include <bits/stdc++.h>
using namespace std;
struct Node {
  int parent = 0;
  vector<int> child;
};
void preorder(vector<Node> T, int p, int x, vector<long>& cnt) {
  if (p == 0) return;
  cnt[p - 1] += x;
  for (int i : T[p].child) {
    preorder(T, i, x, cnt);
  }
}
int main(int argc, char* argv[]) {
  int n, q;
  cin >> n >> q;
  vector<Node> T(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    T[a].child.push_back(b);
    T[b].parent = a;
  }
  vector<long> cnt(n);
  for (int i = 0; i < q; i++) {
    int p, x;
    cin >> p >> x;
    preorder(T, p, x, cnt);
  }
  for (int i = 0; i < n; i++) cout << cnt[i] << " " << flush;
  cout << endl;
  return 0;
}
