#include<cstdio>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;
vector<int> e[200010];
ll cnt[200010];
void dfs(int u,int fa)
{
	cnt[u]+=cnt[fa];
	for(auto v:e[u])if(v!=fa)dfs(v,u);
}
int main()
{
	int n,q;
	scanf("%d%d",&n,&q);
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	while(q--)
	{
		ll x,y;
		scanf("%lld %lld",&x,&y);
		cnt[x]+=y;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++) printf("%lld%c",cnt[i],i==n?'\n':' ');
}