#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define N 200000 + 5

int n, q, Val[N];
vector<int> Vec[N];

void dfs(int z, int fa)
{
	Val[z] += Val[fa];
	for (int d : Vec[z])
		if (d != fa)
			dfs(d, z);
}

int main()
{
	scanf("%d%d", &n, &q);
	for (int i = 1, u, v; i < n; i ++)
	{
		scanf("%d%d", &u, &v);
		Vec[u].push_back(v);
		Vec[v].push_back(u);
	}
	for (int i = 1, p, x; i <= q; i ++)
	{
		scanf("%d%d", &p, &x);
		Val[p] += x;
	}
	dfs(1, 0);
	for (int i = 1; i <= n; i ++)
		printf("%d%c", Val[i], i == n ? '\n' : ' ');
	return 0;
}