#include <bits/stdc++.h>
using namespace std;

int n,q,cnt,h[200005],nex[200005<<1],to[200005<<1],ans[200005];

void addedge(int x,int y)
{
	nex[++cnt] = h[x];
	to[cnt] = y;
	h[x] = cnt;
}

void dfs(int x,int f)
{
	ans[x] += ans[f];
	for(int i=h[x];i;i=nex[i])
		if(to[i]!=f)
			dfs(to[i],x);
}

int main()
{
	cin>>n>>q;
	for(int i=1,x,y;i<n&&cin>>x>>y;i++)
	{
		addedge(x,y);
		addedge(y,x);
	}
	while(q--)
	{
		int x,v;
		cin>>x>>v;
		ans[x] += v;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<' ';cout<<endl;
	
	return 0;
}