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

vector<vector<int>> T(200000);
vector<int> Count(200000, 0);

void solve(int a) {
	for (int i : T[a]) {
		Count[i] += Count[a];
		solve(i);
	}
	return;
}

int main(){
	int N, Q, a, b, p, x;
	cin >> N >> Q;
	for (int i = 0;i < N - 1;i++) {
		cin >> a >> b;
		a--;b--;
		T[a].push_back(b);
	}
	for (int i = 0;i < Q;i++) {
		cin >> p >> x;
		p--;
		Count[p] += x;
	}
	solve(0);
	for (int i = 0;i < N;i++) {
		cout << Count[i] << " ";
	}
}
