#include<bits/stdc++.h>
//#include"Bignum/bignum.h"
//#define lll bignum
#define ls(x) ( x << 1 )
#define rs(x) ( x << 1 | 1 )
#define mid ( ( l + r ) >> 1 )
#define re register
#define For(i, j, k) for(re int i = j; i <= k; i++)
#define foR(i, j, k) for(re int i = j; i >= k; i--)
using namespace std;
typedef long long ll;
const ll N = 200011;

ll n, T, r, k, x, y, cnt, head[N];

struct edge {
	ll to, next;
} e[N << 1];

inline void add( ll u, ll v ) { e[++cnt].to = v, e[cnt].next = head[u], head[u] = cnt; }

namespace IO {

	inline ll read() {
	    ll x = 0; bool f = 0; char ch = getchar();
	    for(; !isdigit( ch ); ch = getchar()) f^=( ch == '-' );
	    for(; isdigit( ch ); ch = getchar()) x = ( x << 3 ) + ( x << 1 ) + ( ch ^ 48 );
	    return f? -x: x;
	}

	inline void write( ll x ) {
	    if( x < 0 ) { putchar( '-' ); x = -x; }
		if( x > 9 ) write( x / 10 );
		putchar( x % 10 | 48 );
	}

	inline void wln( ll x ) { write( x ); putchar( '\n' ); }

}

ll tot, fa[N], rk[N], id[N], dep[N], top[N], size[N], Bigson[N];

namespace Tree_Chain {
	
	inline void dfs1( ll u, ll fath ) {
		dep[u] = dep[fath] + 1, size[u] = 1, fa[u] = fath;
		for( re int i = head[u]; i; i = e[i].next )
			if( e[i].to != fath ) {
				ll v = e[i].to;
				dfs1( v, u ); size[u] += size[v];
				if( size[v] > size[Bigson[u]] ) Bigson[u] = v;
			}
	}
	#define debug(x) (cout << "!" << x << endl)
	inline void dfs2( ll u, ll now_top ) {
		id[u] = ++tot, rk[tot] = u, top[u] = now_top;
		if( !Bigson[u] ) return ; dfs2( Bigson[u], now_top );
		for( re int i = head[u]; i; i = e[i].next ) 
			if( e[i].to != fa[u] && e[i].to != Bigson[u] ) dfs2( e[i].to, e[i].to );
	}
	
}

using namespace Tree_Chain;

ll a[N], ans[N << 2], tag[N << 2];

namespace Segment_Tree {
	
	inline void push_up( ll p ) { ans[p] = ( ans[ls(p)] + ans[rs(p)] ) ; }
	
	inline void push_down( ll p, ll l, ll r ) {
		tag[ls(p)] += tag[p], tag[rs(p)] += tag[p];
		ans[ls(p)] += ( mid - l + 1 ) * tag[p]; 
		ans[rs(p)] += ( r - mid ) * tag[p]; tag[p] = 0; 
	}
	
	inline void build( ll p, ll l, ll r ) {
		if( l == r ) { ans[p] = a[rk[l]] ; return ; }
		build( ls(p), l, mid ); build( rs(p), mid + 1, r ); push_up(p); 
	}
	
	inline void update( ll p, ll l, ll r, ll ul, ll ur, ll k ) {
		if( l >= ul && r <= ur ) {
			ans[p] += ( r - l + 1 ) * k; 
			tag[p] += k; return ;
		} push_down( p, l, r );
		if( mid >= ul ) update( ls(p), l, mid, ul, ur, k );
		if( mid < ur )  update( rs(p), mid + 1, r, ul, ur, k );
		push_up(p);
	}
	
	inline ll query( ll p, ll l, ll r, ll ul, ll ur ) {
		if (l >= ul && r <= ur) return ans[p];
		push_down( p, l, r ); ll sum = 0;
		if( mid >= ul ) sum += query( ls(p), l, mid, ul, ur ); 
		if( mid < ur )  sum += query( rs(p), mid + 1, r, ul, ur ); 
		return sum;
	}

}

using namespace Segment_Tree;

inline void modify( ll x, ll y, ll k ) {
	while( top[x] != top[y] ) {
		if( dep[top[x]] < dep[top[y]] ) swap( x, y );
		update( 1, 1, n, id[top[x]], id[x], k ); x = fa[top[x]];
	} if( id[x] > id[y] ) swap( x, y ); // 当 x 到重链上时，y 已经是祖先了，会少循环一次，所以返回深度小的。
	update( 1, 1, n, id[x], id[y], k );
}

inline ll GetSum( ll x, ll y ) {
	ll res = 0; while( top[x] != top[y] ) {
		if( dep[top[x]] < dep[top[y]] ) swap( x, y );
		res = ( res + query( 1, 1, n, id[top[x]], id[x] ) ) ; x = fa[top[x]];
	} if( id[x] > id[y] ) swap( x, y ); // 同理。 
	res += query( 1, 1, n, id[x], id[y] );
	return res ;
}

int main() {
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = IO::read(), T = IO::read();
	For( i, 1, n ) a[i] = 0;
	For( i, 1, n - 1 ) { 
		ll u = IO::read(), v = IO::read(); 
		add(u, v); add(v, u); }
	dfs1( 1, 0 ); dfs2( 1, 1 ); build( 1, 1, n ); 
	while(T--) {
		x = IO::read(), k = IO::read(); 
		update( 1, 1, n, id[x], id[x] + size[x] - 1, k );
    } 
	For ( i, 1, n ) IO::write(query(1, 1, n, id[i], id[i])), putchar(' ');
	return 0;
}


Measured memory_bytes: 66432