#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i=0, i##_length=(n); i< i##_length; ++i)

template< typename Monoid, typename OperatorMonoid = Monoid >
class LazySegmentTree {
public:
	using F = function< Monoid(Monoid, Monoid) >;
	using G = function< Monoid(Monoid, OperatorMonoid, ll) >;
	using H = function< OperatorMonoid(OperatorMonoid, OperatorMonoid) >;

	ll size;
	vector< Monoid > data;
	vector< OperatorMonoid > lazy;
	const F f;
	const G g;
	const H h;
	const Monoid M1;
	const OperatorMonoid OM0;

	LazySegmentTree(ll n, const F f, const G g, const H h, const Monoid &M1, const OperatorMonoid OM0)
		 : f(f), g(g), h(h), M1(M1), OM0(OM0) {
		size = 1;
		while(size < n) size <<= 1;
		data.assign(2 * size, M1);
		lazy.assign(2 * size, OM0);
	}

	void set(ll k, const Monoid &x) {
		data[k + size] = x;
	}

	void build() {
		for(ll k = size - 1; k > 0; k--) {
			data[k] = f(data[2 * k + 0], data[2 * k + 1]);
		}
	}
	
	void propagate(ll k, ll len) {
		if(lazy[k] != OM0) {
			if(k < size) {
				lazy[2 * k + 0] = h(lazy[2 * k + 0], lazy[k]);
				lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
			}
			data[k] = g(data[k], lazy[k], len);
			lazy[k] = OM0;
		}
	}

	Monoid update(ll a, ll b, const OperatorMonoid &x, ll k, ll l, ll r) {
		propagate(k, r - l);
		if(r <= a || b <= l) {
			return data[k];
		} else if(a <= l && r <= b) {
			lazy[k] = h(lazy[k], x);
			propagate(k, r - l);
			return data[k];
		} else {
			return data[k] = f(update(a, b, x, 2 * k + 0, l, (l + r) >> 1),
				update(a, b, x, 2 * k + 1, (l + r) >> 1, r));
		}
	}

	Monoid update(ll a, ll b, const OperatorMonoid &x) {
		return update(a, b, x, 1, 0, size);
	}

	Monoid query(ll a, ll b, ll k, ll l, ll r) {
		propagate(k, r - l);
		if(r <= a || b <= l) {
			return M1;
		} else if(a <= l && r <= b) {
			return data[k];
		} else {
			return f(query(a, b, 2 * k + 0, l, (l + r) >> 1),
				query(a, b, 2 * k + 1, (l + r) >> 1, r));
		}
	}

	Monoid query(ll a, ll b) {
		return query(a, b, 1, 0, size);
	}

	Monoid operator[](const ll &k) {
		return query(k, k + 1);
	}
};

void dfs(vector<vector<ll>> &g, ll v, ll parent, vector<ll> &trail) {
	trail.push_back(v);
	for(ll nextv:g[v]){
		if(nextv==parent)continue;
		dfs(g, nextv, v, trail);
		trail.push_back(v);
	}
}

signed main() {
	ll N, Q;
	cin>>N>>Q;
	vector<ll> a(N-1,0);
	vector<ll> b(N-1,0);
	vector<ll> q(Q,0);
	vector<ll> x(Q,0);
	rep(i, N-1) cin>>a[i]>>b[i];
	rep(i, Q) cin>>q[i]>>x[i];

	vector<vector<ll>> g(N,vector<ll>());
	for (ll i=0; i<N-1; i++) {
		ll from,to;
		from=a[i];to=b[i];
		from--;to--;
		g[from].push_back(to);
		g[to].push_back(from);
	}

	vector<ll> trail;
	dfs(g, 0, -1, trail);

	map<ll,pair<ll,ll>> m;
	rep(i,trail.size()){
		ll v=trail[i];
		if(m[v].first==0)m[v].first=i;
		m[v].second=i;
	}
	m[0].first=0;

	auto addlambda=[](ll x,ll y){return x+y;};
	auto addlambda1=[](ll x,ll y,ll l){return x+y;};
	LazySegmentTree<ll> st(trail.size(), addlambda, addlambda1, addlambda, 0LL, 0LL);

	rep(i,Q){
		ll from,to;
		from=m[q[i]-1].first;
		to=m[q[i]-1].second;
		st.update(from, to+1, x[i]);
	}

	rep(i,N){
		ll from=m[i].first;
		cout<<st[from]<<' ';
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 64112