#include<bits/stdc++.h>
#include<chrono>
using namespace std;
using namespace chrono;
#define all(a) a.begin(), a.end()
#define sz(x) (int(x.size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef vector<string> vs;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

template<class T, class BO>
struct fastseg{
	int n;
	vector<T> tree;
	BO bin_op;
	T id;
	fastseg(){}
	fastseg(const vector<T> &arr, BO _bin_op, const T &_id): n(arr.size()), bin_op(_bin_op), id(_id){
		tree.resize(n << 1, id);
		for(int i = 0; i < n; i ++){
			tree[i + n] = arr[i];
		}
		build();
	}
	fastseg operator=(const fastseg &target){
		n = target.n, tree = target.tree, bin_op = target.bin_op, id = target.id;
		return *this;
	}
	void build(){
		for(int i = n - 1; i > 0; i --){
			tree[i] = bin_op(tree[i << 1], tree[i << 1 | 1]);
		}
	}
	void update(int l, int r, T val){
		for(l += n, r += n; l < r; l >>= 1, r >>= 1){
			if(l & 1) tree[l ++] += val;
			if(r & 1) tree[-- r] += val;
		}
	}
	T query(int p){
		T res = id;
		for(p += n; p > 0; p >>= 1) res += tree[p];
		return res;
	}
	void push(){
		for(int i = 1; i < n; i ++){
			tree[i << 1] += tree[i];
			tree[i << 1 | 1] += tree[i];
			tree[i] = 0;
		}
	}
	void clear(){
		fill(all(tree), id);
	}
};

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, q;
	cin >> n >> q;
	vector<vi> adj(n);
	for(int i = 1; i < n; i ++){
		int u, v;
		cin >> u >> v, u --, v --;
		adj[u].push_back(v), adj[v].push_back(u);
	}
	vi left(n), right(n);
	int cnt = 0;
	function<void(int, int)> dfs = [&](int u, int p){
		left[u] = cnt ++;
		for(auto &v: adj[u]){
			if(v != p){
				dfs(v, u);
			}
		}
		right[u] = cnt;
	};
	dfs(0, 0);
	fastseg<int, plus<int>> tr(vi(n), plus<int>{}, 0);
	while(q --){
		int p, x;
		cin >> p >> x, p --;
		tr.update(left[p], right[p], x);
	}
	tr.push();
	for(int u = 0; u < n; u ++){
		cout << tr.tree[left[u] + n] << " ";
	}
	return 0;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                  //
//                                                                                                  //
//                                              _____________                                       //
//             ++++++++++                ___------------------\\\\                                  //
//           +++`+``+`+`++++        ///`````````````````````````````\\\                             //
//           ++`+`+``+++`++++  /////```````````````````````````````````\\                           //
//           +++`++`+`+``+++/////`````````````````````````````````````````\\                        //
//             +++`++`+``+///```````````|```````````````````````````````````\\                      //
//          ____++++/++++/`````````````/````````|````````|```````````````````\\                     //
//        /  /  / |    //``````````````|````````|```````|````````|````````````\\                    //
//       /  /  /  | ///````````/```````|```````||```````|````````|``````\```````\\                  //
//       | /  /   |///`````````|``````/````````|````````|````````|```````|```````\\                 //
//       |/   |   |//``|```````|``````|````````|`````````|```````|```````|````````\\                //
//       /\___|__//`|``|```````|`    |      ``:|````````|:```````|```````|```|`````|                //
//      /     /  /``|``|``````|/     |        :|     ```:|```````|```````|``++````++                //
//     /     / //```|``|``````|      |        |:        :|    ```|```````|```++``++`\               //
//     |    /  /````|``|``````/    _.::::.    |          |      |    ````|```|`++`\`|               //
//     |   /   |````|``|`````|            `                    |       ``|```++``++`|               //
//     |  /    |````|``|`````|                                 :         |``++````++|               //
//     | /     /````|``|`````|                              _.-:::.      |..`|``.`|.|               //
//     |/     /`````|``|`````|                                     `     |```|````|`|               //
//    /|      |`````|``|`````|                    :'                    .|```|````|.|               //
//   / |      |`````|``|`````|                                         /|-|``|````|`|               //
//  /  |      |`````|```\````|                                        / ||```|````|``\              //
// /   |      |`````|````|```|::                                    /_| ||```|````|``|              //
//            |`````|````|```|:|:.        `.._                    .\___/:|```|````|``|              //
//            |`````\````|```|:|::-          ``:::....           -:|:|:::|```|````|``|              //
//            |``````|```|```|:|::`|.                          .:::|:|:::|```|````|``|              //
//             \`````|```|```|:|::/|--.                     .`:|:::|:|:::/```|````|``|              //
//              |````|```|```\:|:|:|-----             _..-:|:|:|:::|:|::|````|````|`/               //
//              |````|```|````\|:|:|-------.____.....------|/::|:::|:|::|````|````|`|               //
//              |````|```|\````\:|/\___________    ________/\--\:::|:|::|````/````|`|               //
//              |````\```| \```|:/-------------\  /----------\``\::|:|::|```/`````|`|               //
//              |`````|``|  \``|/---------------\/------------\_________|```|`````|`|               //
//                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                  //
//                                        Created by Aeren                                          //
//                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 32112