#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

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);
	}
};




class Edge {
public:
	ll from,to,cost;
	Edge() {}
	Edge(ll from, ll to, ll cost) : from(from), to(to), cost(cost) {}
};
ostream& operator<<(ostream& s, const Edge& e) {
	s << "{ " << e.from << " -> " << e.to << ", " << e.cost << " }";
	return s;
}

constexpr ll N_MAX = 2;
constexpr ll Q_MAX = 2;
constexpr ll X_J_MAX = 10000;

ll N, Q;


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

void input() {

	cin>>N>>Q;
	
	vector<ll> a(N,0);
	vector<ll>  b(N,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);
	debug(trail);

	map<ll,pair<ll,ll>> m;
	m[0].first=0;
	m[0].second=trail.size()-1;
	repeq(i,trail.size()-2){
		ll v=trail[i];
		if(v==0)continue;
		if(m[v].first==0)m[v].first=i;
		else m[v].second=i;
	}	

	debug(m);

	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;
		debug(from);
		debug(to);
		debug(x[i]);
		st.update(from, to+1,  x[i]);

	}

	debug(st.data);
	debug(st.lazy);
	rep(i,N){
		ll from=m[i].first;
		//debug(from);
		cout<<st[from]<<' ';
		//cout<<st.query(from,from+1)<<' ';
	}
	cout<<endl;
}

signed main() {
	input();

	return 0;
}


Measured memory_bytes: 71272