#include <bits/stdc++.h>
using namespace std;
vector<long long> tree[200010];
long long imos[200010];
long long cnt[200010];
void solve(long long idx, long long par, long long c) {
  c += imos[idx];
  cnt[idx] = c;
  for (auto e : tree[idx]) {
    if (e != par) solve(e, idx, c);
  }
  return;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, q;
  cin >> n >> q;
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  for (long long i = 0; i < q; i++) {
    long long p, x;
    cin >> p >> x;
    imos[--p] += x;
  }
  solve(0, -1, 0);
  cout << cnt[0];
  for (long long i = 1; i < n; i++) {
    cout << " " << cnt[i];
  }
  cout << endl;
  return 0;
}
