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

const int N = 1000 * 200 + 5;
long long n, q, num[N];
vector <long long> adj[N];
bool vis[N];

void dfs(int v) {
	vis[v] = true;
	for (auto u : adj[v])
		if (!vis[u]) 
			num[u] += num[v], dfs(u);
}

int main() {
	cin >> n >> q;
	for (long long i = 1, u, v; i < n; i++)
		cin >> u >> v, adj[u].push_back(v), adj[v].push_back(u);
	for (long long i = 0, a, b; i < q; i++)
		cin >> a >> b, num[a] += b;
	dfs(1);
	for (int i = 1; i <= n; i++)
		cout << num[i] << ' ';
	cout << endl;
}
	