#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;

class Node
{
public:
    ll val;
};

class Graph
{
public:
    vector<Node> Nodes;
    vector<vector<ll>> G;
    Graph(ll N)
    {
        this->G = vector<vector<ll>>(N);
        this->Nodes = vector<Node>(N);
    };
    void addEdge(ll a, ll b)
    {
        this->G[a].push_back(b);
        this->G[b].push_back(a);
    };
};


int main(void)
{
    ll N, Q;
    cin >> N >> Q;
    Graph g(N);
    
    rep(i, N - 1)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        g.addEdge(a,b);
    }

    rep(i, Q)
    {
        ll p, x;
        cin >> p >> x;
        p--;
        g.Nodes[p].val += x;
    }

    //根から全ての木をたどる
    auto dps = [&](auto dps, ll n, ll p) -> void {
        for_each(g.G[n].begin(), g.G[n].end(), [&](auto v) {
            if (v != p)
            {
                g.Nodes[v].val += g.Nodes[n].val;
                dps(dps, v, n);
            }
        });
        return;
    };

    dps(dps, 0, -1);
    rep(i, N)
    {
        if (i > 0)
            cout << " ";
        cout << g.Nodes[i].val;
    }
    cout << endl;
}


