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

vector<ll> G[200009];
ll c[200009];

void dfs(ll u, ll p) {
	c[u] += c[p];
	for(auto v : G[u])
		if(v != p)
			dfs(v, u);
}

int main() {
	ll n, q, u, v;
	cin >> n >> q;

	for(int i = 1; i < n; ++i) {
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}

	while(q--) {
		cin >> u >> v;
		c[u] += v;
	}

	dfs(1, 0);

	cout << c[1];
	for(int i = 2; i <= n; ++i)
		cout << " " << c[i];
	cout << endl;
	return 0;
}