#include <bits/stdc++.h>
using namespace std;
long long c[200005] = {0};
vector<int> g[20005];
void dfs(int cur, int pre = -1) {
  if (cur != 0) {
    c[cur] += c[pre];
  }
  for (int next : g[cur]) {
    if (next != pre) {
      dfs(next, cur);
    }
  }
}
int main(void) {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < (n - 1); i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
  }
  for (int i = 0; i < (q); i++) {
    long long p, x;
    cin >> p >> x;
    p--;
    c[p] += x;
  }
  dfs(0);
  for (int i = 0; i < (n); i++) {
    cout << c[i] << endl;
  }
}
