#include <bits/stdc++.h>
using namespace std;
vector<int> g[20000 + 5];
int a[20000 + 5];
int f(int u, int p, int sum) {
  a[u] += sum;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == p) {
      continue;
    }
    f(v, u, a[u]);
  }
}
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    a[x - 1] += y;
  }
  f(0, -1, 0);
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
