// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
// }}}

// misc {{{
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
// }}}

// debug(...) {{{
static bool debug_enabled = false;
static int debug_max_elms = 10;

static int debug_max_count = 50;
static int debug_current_count = 0;

void debug1(char const * x) { cout << x; }
template<class T> void debug1(const T& x) { cout << x; }
template<class T1, class T2> void debug1(const pair<T1, T2>& x) { cout << "(" << x.first << ", " << x.second << ")"; }
template<class T> void debug1(const vector<T>& x) {
  cout << "[";
  auto i = x.begin();
  while(i != x.end()) {
    debug1(*i);
	++i;
	if(i != x.end()) cout << ", ";
    if(std::distance(x.begin(), i) > debug_max_elms) {
      cout << "...";
      break;
    }
  }
  cout << "]";
}
template<class K, class V> void debug1(const map<K, V>& x) {
  cout << "{";
  auto i = x.begin();
  while(i != x.end()) {
    debug1(get<0>(*i));
    cout << ": ";
    debug1(get<1>(*i));
    ++i;
    if(i != x.end()) cout << ", ";
  }
  cout << "}";
}

void debug2() { cout << endl; }
template<class T, class... Ts> void debug2(const T& x, const Ts&... xs) {
  cout << ' ';
  debug1(x);
  debug2(xs...);
}

template<class T, class... Ts> void debug(const T& x, const Ts&... xs) {
  if(debug_enabled) {
    ++debug_current_count;
    if(debug_current_count > debug_max_count) {
      cout << "... (debug log disabled)" << endl;
      debug_enabled = false;
    }
	cout << "[D] ";
	debug1(x);
	debug2(xs...);
  }
}
// }}}

// main {{{
void solve();
int main() {
  auto v = getenv("DEBUG");
  if(v && string(v) == "1") debug_enabled = true;
  if(false) debug("dummy for suppress warnings", vector<int>(0));
  solve();
}
// }}}

void mkTree(vector<int>& parents, const vector<vector<int>>& con, int root) {
  debug("parents", parents);
  for(auto c: con[root]) {
    if(parents[c] > 0) continue;
    parents[c] = root;
    mkTree(parents, con, c);
  }
}

int calc(vector<int>& sums, const vector<int>& counts, const vector<int>& parents, const vector<vector<int>>& con, int root) {
  if(sums[root] >= 0) return sums[root];
  if(parents[root] == root) return counts[root];
  return sums[root] = counts[root] + calc(sums, counts, parents, con, parents[root]);
}

void solve() {
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> con(N + 1);
  rep(i, N - 1) {
    int a, b;
    cin >> a >> b;
    con[a].push_back(b);
    con[b].push_back(a);
  }
  vector<int> P(N+1), X(N+1);
  rep(i, Q) {
    int p, x;
    cin >> p >> x;
    P[i] = p;
    X[i] = x;
  }

  debug("con:", con);
  vector<int> parents(N + 1);
  parents[1] = 1;
  mkTree(parents, con, 1);

  debug("parents:", parents);

  vector<int> counts(N + 1);

  rep(i, Q) {
    counts[P[i]] += X[i];
  }


  vector<int> sums(N + 1, -1);
  rep2(i, 1, N + 1) {
    cout << calc(sums, counts, parents, con, i) << " ";
  }
  cout << endl;
}


Measured memory_bytes: 26624