#include <bits/stdc++.h>
using namespace std;
const int N=300005;
int n, q, v[N], ans[N];
vector<int> g[N];
void dfs(int x, int p, int val) {
	val+=v[x];
	ans[x]=val;
	for (auto y:g[x]) if (y!=p)
		dfs(y, x, val);
}
int main() {
	cin>>n >>q;
	for (int i=1, x, y;i<n;i++) {
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	while (q--) {
		int x, y;
		cin>>x>>y;
		v[x]+=y;
	}
	dfs(1, 0, 0);
	for (int i=1; i<=n; i++) cout<<ans[i]<<" \n"[i==n];
	return 0;
}