#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
long long N, Q;
vector<long long> G[200200];
long long cnt[200200];
void dfs(long long v, long long pa) {
  long long res = cnt[v];
  for (auto u : G[v]) {
    if (u == pa) continue;
    cnt[u] += res;
    dfs(u, v);
  }
}
void solve() {
  cin >> N >> Q;
  for (long long i = 0; i < N - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (long long i = 0; i < N; i++) {
    cnt[i] = 0;
  }
  for (long long i = 0; i < Q; i++) {
    long long p, x;
    cin >> p >> x;
    p--;
    cnt[p] += x;
  }
  dfs(0, -1);
  for (long long i = 0; i < N; i++) {
    cout << cnt[i] << " ";
  }
  cout << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
