#include <bits/stdc++.h>
using namespace std;
inline int ctoi(char c) {
  if (c < '0' || '9' < c) throw invalid_argument("ctoi error");
  return c - '0';
}
template <typename T>
inline T gcd(T x, T y) {
  if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
  if (x < y) swap(x, y);
  T r = x % y;
  while (r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
template <typename T>
inline T lcm(T x, T y) {
  if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");
  return x * y / gcd(x, y);
}
int n, q;
vector<vector<int>> tree;
vector<long long int> ope;
vector<long long int> ans;
void dfs(int node, long long int x) {
  x += ope[node];
  ans[node] += x;
  if (tree[node].size() == 0) return;
  for (int i = 0; i < (int)(tree[node].size()); i++) {
    dfs(tree[node][i], x);
  }
}
int main() {
  cin >> n >> q;
  tree.resize(n);
  ope.resize(n, 0);
  ans.resize(n, 0);
  for (int i = 0; i < (int)(n - 1); i++) {
    int a, b;
    cin >> a >> b;
    tree[a - 1].push_back(b - 1);
  }
  for (int i = 0; i < (int)(q); i++) {
    int p, x;
    cin >> p >> x;
    ope[p - 1] += x;
  }
  dfs(0, 0);
  for (int i = 0; i < (int)(n); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
