#include <bits/stdc++.h>
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double eps = 0.000000001;
using namespace std;
vector<long long> edge[300000];
long long wa[300000];
long long ans[300000];
long long pa[300000];
void dfs(long long now, long long npo) {
  ans[now] = npo + wa[now];
  for (long long i = 0; (i) < (edge[now].size()); ++(i)) {
    long long nex = edge[now][i];
    if (nex == pa[now]) continue;
    pa[nex] = now;
    dfs(nex, ans[now]);
  }
}
signed main() {
  long long n;
  cin >> n;
  long long q;
  cin >> q;
  for (long long i = 0; (i) < (n - 1); ++(i)) {
    long long a1, b1;
    cin >> a1 >> b1;
    edge[a1].push_back(b1);
    edge[b1].push_back(a1);
  }
  for (long long i = 0; (i) < (q); ++(i)) {
    long long p1, x1;
    cin >> p1 >> x1;
    wa[p1] += x1;
  }
  dfs(1, 0);
  for (long long i = 0; (i) < (n - 1); ++(i)) {
    cout << ans[i + 1] << " ";
  }
  cout << fixed << setprecision(10) << ans[n] << endl;
  return 0;
}
