//JSD
#include<iostream>
#include<vector>
#define ll long long
using namespace std;
ll counter[200001]={0};
vector<int > tree[200001];
bool visited[200001];
ll ans[200001]={0};
void dfs(int s,ll sum){
	visited[s]=1;
	ans[s]+=sum+counter[s];
	for(auto x: tree[s]){
		if(!visited[x]){
			dfs(x,sum+counter[s]);
		}
	}
}
int main(){
	int n,q;
	cin>>n>>q;
	for(int i=0;i<n-1;i++) {
		int u,v;
		cin>>u>>v;
		tree[u].push_back(v);
		tree[v].push_back(u);
	}
	while(q--){
		ll v,x;
		cin>>v>>x;
		counter[v]+=x;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<" ";
	}
	return 0;
}