#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;

template<class T>
struct Gedge {
	LL src, to;
	T cost;
	Gedge(LL s, LL t, T c) :src(s), to(t), cost(c) {}
	Gedge(LL t, T c) :src(-1), to(t), cost(c) {}
};

template<class T>
using WeightedGraph = vector<vector<Gedge<T>>>;
using UnweightedGraph = vector<vector<LL>>;
template<class T>
using Gedges = vector<Gedge<T>>;

struct TNode {
	LL parent;
	VLL childs;
	TNode() :parent(-1) {};
};
using Tree = vector<TNode>;

class HLD {
public:
	Tree& tree;
	LL V;
	VLL depth;   //各頂点が属するHeavy集合の深さ
	VLL top;   //各頂点が属するHeavy集合の一番上の頂点
	VLL in;   //各頂点がEuler-Tourでどこにいるか
	VLL out;   //各頂点の部分木の終わり
	HLD(Tree& t, LL root = 0) :tree(t) {
		V = t.size();
		VLL subtrees(V, -1);
		//各部分木のサイズを求める
		{
			stack<LL> order;
			stack<LL> hold;
			hold.push(root);
			while (!hold.empty()) {
				LL cur = hold.top();
				hold.pop();
				order.push(cur);
				for (LL ch : tree[cur].childs) {
					hold.push(ch);
				}
			}
			while (!order.empty()) {
				LL cur = order.top();
				order.pop();
				subtrees[cur] = 1;
				for (LL& ch : tree[cur].childs) {
					subtrees[cur] += subtrees[ch];
					if (subtrees[ch] > subtrees[tree[cur].childs[0]]) {
						swap(ch, tree[cur].childs[0]);
					}
				}
			}
		}
		//HL分解 with eulertour
		{
			in.resize(V);
			out.resize(V);
			depth.resize(V);
			top.resize(V);
			LL cur = root;
			LL nextid = 0;
			dfs(cur, nextid);
		}
	}
	void dfs(LL cur, LL& nextind) {
		in[cur] = nextind++;
		for (auto ch : tree[cur].childs) {
			//0番目の子は同じHeavy集合
			if (ch == tree[cur].childs[0]) {
				top[ch] = top[cur];
				depth[ch] = depth[cur];
			}
			//それ以外は新しいHeavy集合
			else {
				top[ch] = ch;
				depth[ch] = depth[cur] + 1;
			}
			dfs(ch, nextind);
		}
		out[cur] = nextind - 1;
	}
	LL LCA(LL u, LL v) {
		//uの属するnode.depth >= vの属するnode.depthにする
		if (depth[u] < depth[v]) {
			swap(u, v);
		}
		while (depth[u] > depth[v]) {
			u = tree[top[u]].parent;
		}
		while (top[u] != top[v]) {
			u = tree[top[u]].parent;
			v = tree[top[v]].parent;
		}
		if (in[u] > in[v])return v;
		else return u;
	}
};

//TT(T,T):=モノイドの乗算
//MT(M,T,LL):=モノイドに対する左作用(第3項は要素数)
//MM(M,M):=左作用の合成
template<class T, class M>
class LazySegtree {
public:
	vector<T> seg;
	vector<M> lazy;   //実、更新の必要性
	typedef function<T(T, T)> TT;
	typedef function<T(M, T, LL)> MT;
	typedef function<M(M, M)> MM;
	TT tt;
	MT mt;
	MM mm;
	M Me;
	T Te;
	LL snum;   //何回シフトで下段から1に行けるか
	LazySegtree(LL N, TT _tt, MT _mtn, MM _mm, T te, M me) {
		LL RN = 1;
		snum = 0;
		while (RN < N) {
			RN *= 2;
			snum++;
		}
		Te = te;
		Me = me;
		seg.resize(2 * RN, Te);
		lazy.resize(2 * RN, Me);
		tt = _tt;
		mt = _mtn;
		mm = _mm;
	}
	LazySegtree(vector<T>& vec, TT _tt, MT _mt, MM _mm, T te, M me) {
		LL RN = 1;
		snum = 0;
		while (RN < vec.size()) {
			RN *= 2;
			snum++;
		}
		Te = te;
		Me = me;
		seg.resize(2 * RN, Te);
		lazy.resize(2 * RN, Me);
		tt = _tt;
		mt = _mt;
		mm = _mm;
		for (LL n = 0; n < vec.size(); n++) seg[RN + n] = vec[n];
		for (LL n = RN - 1; n >= 1; n--) {
			seg[n] = tt(seg[2 * n], seg[2 * n + 1]);
		}
	}
	void eval(LL k, LL l, LL r) {
		if (k >= seg.size())return;
		if (lazy[k] == Me)return;
		seg[k] = mt(lazy[k], seg[k], r - l + 1);
		if (k < seg.size() / 2) {
			lazy[2 * k] = mm(lazy[k], lazy[2 * k]);
			lazy[2 * k + 1] = mm(lazy[k], lazy[2 * k + 1]);
		}
		lazy[k] = Me;
	}
	void apply(LL a, LL b, M m, LL k, LL l, LL r) {
		eval(k, l, r);
		if (r < a || b < l)return;
		if (a <= l && r <= b) {
			lazy[k] = mm(m, lazy[k]);
			eval(k, l, r);
		}
		else {
			apply(a, b, m, 2 * k, l, (l + r) / 2);
			apply(a, b, m, 2 * k + 1, (l + r) / 2 + 1, r);
			seg[k] = tt(seg[2 * k], seg[2 * k + 1]);
		}
	}
	void apply(LL a, LL b, M m) {
		apply(a, b, m, 1, 0, seg.size() / 2 - 1);
	}
	T get(LL a, LL b, LL k, LL l, LL r) {
		if (r < a || b < l)return Te;
		eval(k, l, r);
		if (a <= l && r <= b)return seg[k];
		else return tt(get(a, b, 2 * k, l, (l + r) / 2), get(a, b, 2 * k + 1, (l + r) / 2 + 1, r));
	}
	T get(LL a, LL b) {
		return get(a, b, 1, 0, seg.size() / 2 - 1);
	}
};

void SetTree(UnweightedGraph& G, Tree& T, LL root = 0) {
	T.resize(G.size());
	stack<PLL> st;
	st.push(PLL(root, -1));
	while (!st.empty()) {
		LL cur = st.top().first;
		LL p = st.top().second;
		st.pop();
		T[cur].parent = p;
		for (LL ch : G[cur]) {
			if (ch == p)continue;
			T[cur].childs.push_back(ch);
			st.push(PLL(ch, cur));
		}
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, Q;
	cin >> N >> Q;
	UnweightedGraph G(N);
	for (LL n = 0; n < N - 1; n++) {
		LL a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	Tree T;
	SetTree(G, T, 0);
	HLD hld(T, 0);
	LazySegtree<LL, LL> seg(N, [](LL a, LL b) {
		return a + b;
	}, [](LL m, LL t, LL n) {
		return t + m * n;
	}, [](LL a, LL b) {
		return a + b;
	}, 0, 0);
	for (LL q = 0; q < Q; q++) {
		LL p, x;
		cin >> p >> x;
		p--;
		LL st = hld.in[p];
		LL en = hld.out[p];
		seg.apply(st, en, x);
	}
	for (LL n = 0; n < N; n++) {
		cout << seg.get(hld.in[n], hld.in[n]) << " ";
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 47732