#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

struct Unit {};

namespace { // Graph Basics

template<typename WeightT>
struct Edge {
  int from, to;
  WeightT weight;
  Edge(int s, int d, WeightT w): from(s), to(d), weight(w) {}
};

template<typename WeightT>
bool
operator< (Edge<WeightT> const &lhs, Edge<WeightT> const &rhs) {
  if (lhs.weight != rhs.weight) {
    return lhs.weight < rhs.weight;
  } else if (lhs.from != rhs.from) {
    return lhs.from < rhs.from;
  }
  return lhs.to < rhs.to;
}

template<typename WeightT>
using Edges = std::vector<Edge<WeightT> >;

template<typename WeightT>
using AdjacencyList = std::vector<Edges<WeightT> >;

template<typename WeightT>
void
add_undir_edge(AdjacencyList<WeightT> &graph, int u, int v, WeightT w) {
  graph[u].emplace_back(u, v, w);
  graph[v].emplace_back(v, u, w);
}

} // namespace

using Graph = AdjacencyList<Unit>;

using namespace std;

vector<vector<int>> dfs(Graph const &g, int root) {
  stack<int> stk;
  vector<vector<int>> children(g.size());
  vector<bool> visited(g.size(), false);
  stk.push(root);
  while (!stk.empty()) {
    auto const u = stk.top(); stk.pop();
    if (visited[u]) { continue; }
    visited[u] = true;
    for (auto &&e : g[u]) {
      if (visited[e.to]) { continue; }
      children[u].push_back(e.to);
      stk.push(e.to);
    }
  }
  return children;
}

void solve(Graph const &g, vector<lli> const &delta) {
  auto const children = dfs(g, 0);
  stack<tuple<int,lli>> stk;
  vector<lli> vals(g.size(), 0);
  stk.emplace(0, 0);
  while (!stk.empty()) {
    int u; lli dx; tie(u, dx) = stk.top(); stk.pop();
    vals[u] = dx + delta[u];
    for (auto &&v : children[u]) {
      stk.emplace(v, vals[u]);
    }
  }
  bool fst = true;
  for (auto &&v : vals) {
    printf("%s%lld", fst? "": " ", v);
    fst = false;
  }
  printf("\n");
}

int main() {
  // cout << fixed << setprecision(10);

  int N, Q; cin >> N >> Q;
  Graph g(N);
  REP(i, N-1) {
    int A, B; cin >> A >> B;
    add_undir_edge(g, --A, --B, Unit());
  }
  vector<lli> delta(N, 0);
  REP(i, Q) {
    lli P, X;
    cin >> P >> X;
    delta[--P] += X;
  }
  solve(g, delta);
  return 0;
}


Measured memory_bytes: 27596