#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int timer = 0;
vector<int> a[N], tin(N), tout(N);
long long ans[N + 5];
void dfs(int x, int p = -1) {
  tin[x] = ++timer;
  for (auto i : a[x])
    if (i != p) dfs(i, x);
  tout[x] = timer;
}
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  memset(ans, 0, sizeof ans);
  dfs(1);
  while (q--) {
    int p, x;
    cin >> p >> x;
    ans[tin[p]] += x;
    ans[tout[p] + 1] -= x;
  }
  for (int i = 2; i <= n; ++i) ans[i] += ans[i - 1];
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
}
