#include <bits/stdc++.h>
using namespace std;
class BFS {
  vector<int> tree, state;
  vector<vector<int>> edges;
  int N, Q;

 public:
  BFS(int n = 0, int q = 0) : N(n), Q(q) {
    tree.resize(N);
    state.resize(N);
    edges.resize(N);
    load_edge();
  }
  void load_edge() {
    int u, v;
    for (int i = 0; i < N - 1; i++) {
      cin >> u >> v;
      edges.at(--u).push_back(--v);
      edges.at(v).push_back(u);
    }
    int p, x;
    for (int i = 0; i < Q; i++) {
      cin >> p >> x;
      tree.at(--p) += x;
    }
  }
  void bfs(int node) {
    queue<int> qu;
    qu.push(node);
    while (!qu.empty()) {
      node = qu.front();
      qu.pop();
      for (int v : edges.at(node)) {
        if (state.at(v) != 1) {
          qu.push(v);
          tree.at(v) += tree.at(node);
        }
      }
      state.at(node) = 1;
    }
  }
  void print() {
    for (int i = 0; i < N; i++) {
      if (i) cout << " ";
      cout << tree.at(i);
    }
    cout << endl;
  }
};
int main() {
  int N, Q;
  cin >> N >> Q;
  BFS bfs(N, Q);
  bfs.bfs(0);
  bfs.print();
}
