#include <bits/stdc++.h>
using ll = long long;
std::unordered_map<int, std::vector<int>> adjecent;
std::unordered_map<int, ll> node2score;
std::vector<int> sol;
void solve(int n, int pass) {
  sol[n] = node2score[n] + pass;
  if (adjecent.count(n) != 0) {
    for (int i : adjecent[n]) {
      solve(i, sol[n]);
    }
  } else {
  }
}
int main(void) {
  int N, Q;
  std::cin >> N >> Q;
  sol = std::vector<int>(N + 1, 0);
  int a, b;
  for (int i = 0; i < N - 1; ++i) {
    std::cin >> a >> b;
    if (a < b) {
      adjecent[a].push_back(b);
    } else {
      adjecent[b].push_back(a);
    }
  }
  int p, x;
  for (int i = 0; i < Q; ++i) {
    std::cin >> p >> x;
    node2score[p] += x;
  }
  solve(1, 0);
  for (int i = 1; i < sol.size(); ++i) {
    std::cout << sol[i] << " ";
  }
  std::cout << std::endl;
  return 0;
}
