#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > vp;
long long dd[500300];
long long index1;
vector<vector<long long> > vv;
void dfs(long long a, long long p, long long h) {
  if (vv[a].size() == 1 && p != -1) {
    vp[a] = make_pair(index1, index1 + 1);
    index1 += 2;
    return;
  }
  long long p1, p2;
  p1 = index1;
  index1++;
  for (long long i = (0); i < (vv[a].size()); ++i) {
    if (vv[a][i] == p) continue;
    dfs(vv[a][i], a, h + 1);
  }
  p2 = index1;
  index1++;
  vp[a] = make_pair(p1, p2);
  return;
}
int main() {
  long long n, q;
  cin >> n >> q;
  vector<vector<long long> > vv_(n, vector<long long>());
  vv = vv_;
  vector<pair<long long, long long> > vp_(n, pair<long long, long long>());
  vp = vp_;
  for (long long i = (0); i < (n - 1); ++i) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    vv[a].push_back(b);
    vv[b].push_back(a);
  }
  index1 = 0;
  dfs(0, -1, 0);
  memset((dd), (0), sizeof(dd));
  for (long long i = (0); i < (q); ++i) {
    long long p, x;
    cin >> p >> x;
    p--;
    long long l = vp[p].first;
    long long r = vp[p].second;
    dd[l] += x;
    dd[r] -= x;
  }
  for (long long i = (1); i < (500300); ++i) {
    dd[i] += dd[i - 1];
  }
  vector<long long> ans;
  for (long long i = (0); i < (n); ++i) {
    long long l = vp[i].first;
    ans.push_back(dd[l]);
  }
  for (long long i = (0); i < (ans.size()); ++i) {
    cout << ans[i];
    if (i != ans.size() - 1) cout << " ";
  }
  cout << endl;
  return 0;
}
