#include <bits/stdc++.h>
using namespace std;
const int max_n = 1e5;
const long long mod = 1e9 + 7;
void send(int a, int b, int c, int d) { printf("%d %d %d %d\n", a, b, c, d); }
struct edge {
  int to;
  long long cost;
};
vector<vector<long long> > v;
vector<long long> ans;
void dfs(int u, int pre) {
  for (int next : v[u]) {
    if (next != pre) {
      ans[next] += ans[u];
      dfs(next, u);
    }
  }
}
int main() {
  int n, q;
  cin >> n >> q;
  v.resize(n);
  ans.assign(n, 0);
  for (long long i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    v[y].push_back(x);
    v[x].push_back(y);
  }
  long long sum = 0;
  for (long long i = 0; i < q; i++) {
    int x;
    long long y;
    cin >> x >> y;
    --x;
    ans[x] += y;
  }
  dfs(0, -1);
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
