#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = acos(-1);
const ll INF = 1e15;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge {
  ll to, cost;
};
const ll MXN = 200000;
vector<ll> G[MXN];
vector<ll> ans;
vector<ll> d;
void dfs(ll x, ll y) {
  ans[x] = y;
  ll k = G[x].size();
  if (k != 0) {
    for (ll i = 0; i < k; i++) {
      if (ans[G[x][i]] == 0) {
        dfs(G[x][i], y + d[G[x][i]]);
      }
    }
  }
}
int main() {
  ll N, Q;
  cin >> N >> Q;
  ll a, b, p, x;
  ans.resize(N, 0);
  d.assign(N, 0);
  for (ll i = 0; i < N - 1; i++) {
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (ll i = 0; i < Q; i++) {
    cin >> p >> x;
    p--;
    d[p] += x;
  }
  dfs(0, d[0]);
  for (ll i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }
}
