//https://atcoder.jp/contests/abc138/tasks/abc138_d
//D - Ki
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}

template< typename T >
struct edge {
	int src, to;
	T cost;
	edge(int _to, T _cost) : src(-1), to(_to), cost(_cost) {}
	edge(int _src, int _to, T _cost) : src(_src), to(_to), cost(_cost) {}
	edge &operator=(const int &x) {
		to = x;
		return *this;
	}
	operator int() const { return to; }
};

template< typename T>
struct node {
	vector<edge<T>> edges;
    ll count=0;
    ll total=0;
    ll index=-1;
    ll work=-1;
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< node< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in");
    //std::ifstream in("./input.txt");
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N,Q; cin>>N>>Q;
    WeightedGraph<ll> graph(N+1);    
    REP(i,N-1){
        ll a,b; cin>>a>>b;
        graph.at(a).edges.emplace_back(a,b,1);
        graph.at(b).edges.emplace_back(b,a,1);
    }
    vector<pair<ll,ll>> pxq(Q);
    for(auto&& px:pxq){
        cin>>px.first>>px.second;
        graph.at(px.first).count+=px.second;
    }

    ll index=0;
    function<void(ll,ll)> dfs0 = [&](ll n,ll count){
        auto& node = graph.at(n);
        if(node.index>=0) return;
        node.index = index++;
        node.total = node.count + count;
        for(auto&& e: node.edges){
            dfs0(e.to, node.total);
        }
    };
    dfs0(1,0);

    FOR(i,1, N+1){
        if (i!=1) cout<<" ";
        cout<<graph.at(i).total;
    }
    cout<<endl;
    return 0;
}

int main_() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in");
    //std::ifstream in("./input.txt");
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N,Q; cin>>N>>Q;
    WeightedGraph<ll> graph(N+1);    
    REP(i,N-1){
        ll a,b; cin>>a>>b;
        graph.at(a).edges.emplace_back(a,b,1);
        graph.at(b).edges.emplace_back(b,a,1);
    }
    vector<pair<ll,ll>> pxq(Q);
    for(auto&& px:pxq){
        cin>>px.first>>px.second;
    }

    ll index=0;
    function<void(ll)> dfs0 = [&](ll n){
        auto& node = graph.at(n);
        if(node.index>=0) return;
        node.index = index++;
        for(auto&& e: node.edges){
            dfs0(e.to);
        }
    };
    dfs0(1);

    function<void(ll,ll,ll,ll)> dfs = [&](ll n, ll add, ll work_id, ll parent){
        auto& node = graph.at(n);
        if (node.index < parent) return;
        if (node.work == work_id) return;
        node.count += add;        
        node.work = work_id;
        for(auto&& e: node.edges){
            dfs(e.to, add, work_id, node.index);
        }
    };
    FOR(i,0,pxq.size()){
        const auto& px=pxq.at(i);
        dfs(px.first, px.second, i, -1);
    }

    FOR(i,1, N+1){
        if (i!=1) cout<<" ";
        cout<<graph.at(i).count;
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 39424