#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<int, int> p_i;

#define rep(i, n) for (ll i = 0LL; i < n; i++)
#define repext(i, a, b) for (ll i = a; i < b; i++)
#define reprev(i, n) for (ll i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (ll i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0LL)
#define srt(vec) sort(vec_all(vec))
#define rev(vec) reverse(vec_all(vec))
#define revsrt(vec) \
    srt(vec);       \
    rev(vec)

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T, typename S>
void dump_dic(map<T, S> dic)
{
    for (auto v : dic)
    {
        cout << v.first << ": " << v.second << endl;
    }
}

struct Tree
{
    int n; // 頂点数
    int top;
    vector<vector<int>> graph;
    vector<int> parent;
    vector<int> rank;

    // 1-origin
    Tree(vector<p_i> edges, int root = 0)
    {
        n = edges.size() + 1;
        graph = vector<vector<int>>(n + 1, vector<int>());
        parent = vector<int>(n + 1, 0);
        rank = vector<int>(n + 1, 0);
        repv(v, edges)
        {
            graph[v.first].push_back(v.second);
            graph[v.second].push_back(v.first);
        }

        if (root != 0)
        {
            top = root;
            queue<int> que;
            que.push(root);
            parent[root] = 0;
            rank[root] = 1;
            vector<int> child;
            int current;
            while (que.size() > 0)
            {
                current = que.front();
                que.pop();
                child = graph[current];
                repv(v, child)
                {
                    if (rank[v] == 0)
                    {
                        rank[v] = rank[current] + 1;
                        parent[v] = current;
                        que.push(v);
                    }
                }
            }
        }
    }

    // f: data[child] = f(child, parent, data)
    template <typename T, class Fn>
    vector<T> bfs(vector<T> data, Fn f, int start)
    {
        queue<int> que;
        que.push(start);
        vector<int> child;
        int current;
        while (que.size() > 0)
        {
            current = que.front();
            que.pop();
            child = graph[current];
            repv(v, child)
            {
                if (rank[v] > rank[current])
                {
                    data[v] += data[current];
                    que.push(v);
                }
            }
        }
        return data;
    }
};

// --- notice ---
// intの和はllにしろ

int main()
{
    int n, q;
    cin >> n >> q;
    vector<p_i> edge;
    int _a, _b;
    rep(i, n - 1) {
        cin >> _a >> _b;
        edge.push_back(p_i(_a, _b));
    }

    Tree tree = Tree(edge, 1);

    vector<p_i> query(q);
    int _p, _x;
    rep(i, q)
    {
        cin >> _p >> _x;
        query[i] = p_i(_p, _x);
    }

    vector<int> m(n + 1, 0);
    repv(v, query)
    {
        _p = v.first;
        m[_p] += v.second;
    }

    vector<int> res_m = tree.bfs(m, [](int p, int c, vector<int> m){
        return m[p] + m[c];
    }, 1);

    repext(i, 1, n + 1) {
        cout << res_m[i] << " ";
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 21716