#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graph(200002);
long long cnt[200002];
long long ans[200002];
bool visited[200002];
void dfs(int st) {
  fill(visited, visited + 200002, 0);
  vector<pair<int, long>> stack =
      vector<pair<int, long>>{pair<int, long long>{st, cnt[st]}};
  while (stack.size()) {
    pair<int, long long> elem = stack.back();
    stack.pop_back();
    if (visited[elem.first]) {
      continue;
    }
    visited[elem.first] = 1;
    ans[elem.first] = elem.second;
    for (auto i : graph[elem.first]) {
      stack.push_back(pair<int, long long>{i, cnt[i] + elem.second});
    }
  }
}
int main() {
  fill(cnt, cnt + 200002, 0);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n - 1; i++) {
    int ai, bi;
    cin >> ai >> bi;
    graph[ai].push_back(bi);
    graph[bi].push_back(ai);
  }
  for (int i = 0; i < q; i++) {
    int k, p;
    cin >> k >> p;
    cnt[k] += p;
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << ' ';
  }
  return 0;
}
