#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q1;
  cin >> n >> q1;
  vector<vector<long long>> adj(n + 1);
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<long long> vv(n + 1, 0), v1(n + 1, 0);
  for (long long i = 0; i < q1; i++) {
    long long x, y;
    cin >> x >> y;
    vv[x] += y;
  }
  long long z = 0;
  bool vis[200001] = {0};
  queue<long long> q;
  q.push(1);
  vis[1] = 1;
  while (!q.empty()) {
    long long p = q.front();
    q.pop();
    for (long long i = 0; i < adj[p].size(); i++) {
      if (!vis[adj[p][i]]) {
        q.push(adj[p][i]);
        vv[adj[p][i]] += vv[p];
        vis[adj[p][i]] = 1;
      }
    }
  }
  for (long long i = 1; i <= n; i++) cout << vv[i] << " ";
}
