#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <class T>
using grid = vector<vector<T>>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
static const lint MOD = (lint)1e9 + 7;
int N, Q;
grid<int> graph;
map<int, int> mp;
void input() {
  cin >> N >> Q;
  graph.resize(N);
  int a, b;
  for (int i = 0, i_len = (N - 1); i < i_len; ++i) {
    cin >> a >> b;
    a--;
    b--;
    graph[a].push_back(b);
  }
  int p, x;
  for (int i = 0, i_len = (Q); i < i_len; ++i) {
    cin >> p >> x;
    mp[p - 1] += x;
  }
}
void solve() {
  vector<int> cnt(N, 0);
  queue<lint> que;
  que.push(0);
  cnt[0] = mp[0];
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    for (int i = 0, i_len = (((int)(graph[now]).size())); i < i_len; ++i) {
      que.push(graph[now][i]);
      cnt[graph[now][i]] = cnt[now] + mp[graph[now][i]];
    }
  }
  for (int i = 0, i_len = (((int)(cnt).size())); i < i_len; ++i) {
    cout << cnt[i] << "\n";
    cout << cnt[i] << " ";
  }
}
int main() {
  input();
  solve();
  return 0;
}
