#include <bits/stdc++.h>
using namespace std;
bool used[2000006];
vector<int> adj[2000006];
long long c[2000006] = {0};
void dfs(int s, int val) {
  c[s] += val;
  for (auto i : adj[s]) dfs(i, val);
}
int main() {
  {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
  }
  map<int, long long int> mapp;
  for (int i = 0; i < m; i++) {
    long long a, val;
    cin >> a >> val;
    mapp.insert({a, mapp[a] += val});
  }
  for (auto i : mapp) {
    memset(used, 0, sizeof(used));
    dfs(i.first, i.second);
  }
  for (int i = 1; i <= n; i++) cout << c[i] << " ";
}
