#include <bits/stdc++.h>
using namespace std;
vector<pair<set<int>, int> > graph;
vector<long long> summation;
void DFS(int node, int x, long long carry) {
  if (node == x) {
    summation[x] += graph[node].second + carry;
    return;
  }
  if (graph[node].first.empty() || node > x) return;
  for (set<int>::iterator it = graph[node].first.begin();
       it != graph[node].first.end(); it++) {
    DFS(*it, x, carry + graph[node].second);
  }
}
int main() {
  int n, q;
  cin >> n >> q;
  graph.resize(n);
  summation.resize(n, 0);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    graph[x - 1].first.insert(y - 1);
    graph[x - 1].second = 0;
  }
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    graph[x - 1].second += y;
  }
  for (int i = 0; i < n; i++) {
    DFS(0, i, 0);
  }
  for (int i = 0; i < n; i++) {
    cout << summation[i] << " ";
  }
  cout << endl;
  return 0;
}
