// Slower C++ solution:
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

template <class T>

inline bool chmax(T &a, T b) {

  if (a < b) {

    a = b;

    return 1;

  }

  return 0;

}



typedef long long ll;



vector<ll> to[200005];

vector<ll> ans;



void dfs(ll i, ll p = -1) {

  for (auto v : to[i]) {

    if (p == v) continue;

    ans[v] += ans[i];

    dfs(v, i);

  }

}



int main() {

  int n, q;

  cin >> n >> q;



  for (ll i = 0; i < n-1; i++)  {

    ll a, b;

    cin >> a >> b;

    a--;

    b--;

    to[a].push_back(b);

    to[b].push_back(a);

  }

  ans.resize(n);

  for (ll i = 0; i < q; i++)  {

    ll p, x;

    cin >> p >> x;

    ans[p-1] += x;

  }

  dfs(0);

  for (ll i = 0; i < n; i++) {

    cout << ans[i] << ' ';

  }

  cout << endl;

  return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.328419947157472x):
#include <algorithm>

#include <iostream>

#include <vector>

#include <iomanip>

using namespace std;

template <class T>

inline bool chmax(T &a, T b) {

  if (a < b) {

    a = b;

    return 1;

  }

  return 0;

}



typedef long long ll;

ll MOD = 1000000007;



// a^p

// 2^3 = 2 * 2^2

// 2^2 = 2 * (2^1)

// 2^1 = 2

ll modpow(ll a, ll p, ll mod) {

  if (p == 0) return 1;



  if (p % 2 == 0) {

    ll half = modpow(a, p / 2, mod) % mod;

    return half * half % mod;

  } else {

    return a * modpow(a, p - 1, mod) % mod;

  }

}



// nCa を求める

ll modCombination(ll n, ll a, ll mod) {

  if (n - a < a) {

    return modCombination(n, n - a, mod);

  }



  ll denominator = 1;  // 分母

  ll numerator = 1;    // 分子



  for (ll i = 0; i < a; i++) {

    denominator *= a - i;

    numerator *= n - i;

    denominator %= mod;

    numerator %= mod;

  }



  return numerator * modpow(denominator, mod - 2, mod) % mod;

}



class UnionFind {

 private:

  vector<ll> parents;



 public:

  UnionFind(ll n) : parents(n, -1) {}



  bool issame(ll x, ll y) { return root(x) == root(y); }



  bool merge(ll x, ll y) {

    if (issame(x, y)) return false;



    ll rx = root(x);

    ll ry = root(y);

    if (parents[rx] > parents[ry]) swap(rx, ry);

    // サイズ情報を更新

    parents[rx] += parents[ry];

    // yの親を更新

    parents[ry] = rx;



    return true;

  }



  ll size(ll x) { return -parents[root(x)]; }



 private:

  ll root(ll x) {

    if (parents[x] < 0) return x;

    // 根の親の値に木の(-)サイズの情報を入れる

    return parents[x] = root(parents[x]);

  }

};



void dfs(const vector<vector<ll>> &G, vector<ll> &points, vector<bool> &seen,

         ll p) {

  if (seen[p]) {

    return;

  }

  seen[p] = true;

  for (auto g : G[p]) {

    if (seen[g] == false) {

      points[g] += points[p];

      dfs(G, points, seen, g);

    }

  }

}



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(15);



  ll N, Q;

  cin >> N >> Q;



  vector<vector<ll>> G(N, vector<ll>());



  for (ll i = 0; i < N - 1; i++) {

    ll a, b;

    cin >> a >> b;

    a--;

    b--;

    G[a].push_back(b);

    G[b].push_back(a);

  }



  vector<ll> points(N, 0);

  vector<bool> seen(N, false);

  for (ll i = 0; i < Q; i++) {

    ll p, x;

    cin >> p >> x;

    p--;

    points[p] += x;

  }



  dfs(G, points, seen, 0);

  for (auto p : points) {

    cout << p << " ";

  }

  cout << endl;



  return 0;

}