#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[200005];
vector<long long> res;
void dfs(long long v, long long p = -1) {
  for (auto itr : adj[v]) {
    if (itr == p) continue;
    res[itr] += res[v];
    dfs(itr, v);
  }
}
int main() {
  long long n, q;
  cin >> n >> q;
  long long a, b;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  long long p, x;
  res.resize(n);
  for (int i = 0; i < q; i++) {
    cin >> p >> x;
    p--;
    res[p] += x;
  }
  dfs(0);
  for (int i = 0; i < n; i++) {
    cout << res[i] << " ";
  }
}
