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

const int N = 2e5 + 5;
vector<int> adj[N];
int vals[N]; 
int pref[N];

void dfs(int v, int x){
	x += pref[v];
	vals[v] += x;
	for(int u:adj[v]){
		dfs(u, x);
	}
}

int main(){
	int n, m;
	cin>>n>>m;
	memset(vals, 0, sizeof(vals));
	memset(pref, 0, sizeof(pref));
	for(int i = 1;i<n;i++){
		int t1, t2;
		cin>>t1>>t2;
		adj[t1].push_back(t2);
	}
	for(int i = 0;i<m;i++){
		int a, b;
		cin>>a>>b;
		pref[a] += b;
	}
	dfs(1, 0);
	for(int i = 1;i<=n;i++){
		cout<<vals[i]<<" ";
	}
	cout<<endl;
	return 0;
}