#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long
 
template<typename T> inline constexpr auto square(T x) { return (x) * (x); }
 
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
 
const int MOD = 1000000007;
const int INF = INT_MAX;
 
signed main()
{
	int N, Q;
	cin >> N >> Q;
 
	VI oya(N);
	int a, b;
	rep(i, N - 1) {
		cin >> a >> b;
		oya[b - 1] = a - 1;
	}
 
	VI c(N, 0);
	int p, x;
	rep(i, Q) {
		cin >> p >> x;
		c[p - 1] += x;
	}
 
	rng(i, 1, N) {
		c[i] += c[oya[i]];
	}
 
	rbf(ans, c) {
		CO(ans);
		CO(' ');
	}
 
	CO(endl);
 
	return 0;
}