#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> dist_list;

class RootedNode{
public:
	vector<ll> parent;
	ll depth,dist;
	RootedNode():depth(0),dist(0){}
};

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

class RootedTree{
	int parent_size;

	void DFS(ConnectNodeInfo& connection,ll child,ll parent,ll dep,ll dist){
		node[child].parent[0] = parent;
		node[child].depth = dep;
		node[child].dist = dist;

		for(int i = 0;i < connection[child].size();i++){
			if(connection[child][i].first != parent){
				DFS(connection,connection[child][i].first,child,dep+1,dist+connection[child][i].second);
			}
		}
	}
public:
	vector<RootedNode> node;

	RootedTree(ConnectNodeInfo& connection){
		auto connection_size = connection.size();
		parent_size = 1;
		while((1LL<<parent_size)<connection_size) parent_size++;

		node.resize(connection_size);
		for(auto& x:node) x.parent.resize(parent_size,-1);
		DFS(connection,0,-1,0,0);
		for(int k=0;k<parent_size-1;k++){
			for(int v=0,ev=connection_size;v<ev;v++){
				if(node[v].parent[k] < 0) node[v].parent[k+1] = -1;
				else node[v].parent[k+1] = node[node[v].parent[k]].parent[k];
			}
		}
	}
	ll FindLCA(ll u,ll v){
		if(node[u].depth > node[v].depth) swap(u,v);
		for(int k=0;k<parent_size;k++){
			if((node[v].depth - node[u].depth) & (1LL<<k)){
				v = node[v].parent[k];
			}
		}
		if(u==v) return u;
		for(int k=parent_size-1;k>=0;k--){
			if(node[u].parent[k] != node[v].parent[k]){
				u = node[u].parent[k];
				v = node[v].parent[k];
			}
		}
		return node[u].parent[0];
	}
	ll GetDistance(ll u){
		ll dist = node[u].dist;
		if(node[u].parent[0]!=-1){
			dist += dist_list[node[u].parent[0]];
		}
		dist_list[u] = dist;
		return dist;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N=in(),Q=in();
	dist_list.resize(N,-1);
	ConnectNodeInfo connect(N);
	REP(i,N-1){
		int a=in()-1,b=in()-1;
		connect.AddConnection(a,b,0);
	}
	RootedTree tree(connect);
	REP(i,Q){
		int p=in()-1,x=in();
		tree.node[p].dist += x;
	}

	dist_list[0] = tree.node[0].dist;
	for(int i=0;i<N-1;i++){
		cout << tree.GetDistance(i) << " ";
	}
	out(tree.GetDistance(N-1));
	return 0;
}


Measured memory_bytes: 67200