// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

typedef long long ll;

const int INF = 1001001001;



vector<int> tos[200005];

vector<int> ans;



void dfs(int v, int p = -1) {

    for (int u : tos[v]) {

        if (u == p)continue;

        ans[u] += ans[v];

        dfs(u, v);

    }

}



int main() {



    int n, q;

    cin >> n >> q;



    rep(i, n - 1) {

        int a, b;

        cin >> a >> b;

        a--;

        b--;

        tos[a].push_back(b);

        tos[b].push_back(a);

    }

    ans.resize(n);

    rep(i, q) {

        int p, x;

        cin >> p >> x;

        p--;

        ans[p] += x;

    }



    dfs(0);

    rep(i, n) {

        cout << ans[i] << ' ';

    }

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#include <cmath>



const double PI = 3.14159265358979323846;

//using namespace boost::multiprecision;

using namespace std;

typedef long long ll;

const double EPS = 1e-9;

#define rep(i, n) for (int i = 0; i < (n); ++i)

typedef pair<ll, ll> P;

const ll INF = 1e15;

#define cmin(x, y) x = min(x, y)

#define cmax(x, y) x = max(x, y)

#define ret() return 0;



std::istream &operator>>(std::istream &in, set<int> &o) {

    ll a;

    in >> a;

    o.insert(a);

    return in;

}



std::istream &operator>>(std::istream &in, queue<int> &o) {

    ll a;

    in >> a;

    o.push(a);

    return in;

}



bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }



//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");

//ofstream outfile("log.txt");

//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;

// std::cout << std::bitset<8>(9);

const int mod = 1000000007;

//const ll mod = 1e10;

typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;



struct Triangle {

    int parent;

    vector<int> children;

};



class Tree {

    vector<vector<int>> edges;

public:

    Tree(int n) : edges(n) {}



    void edge(int i, int j) {

        edges[i].push_back(j);

        edges[j].push_back(i);

    }



    void root(int r, vector<Triangle> &leafs) {

        queue<int> vs;

        vs.push(r);

        vector<bool> check(edges.size(), false);

        check[r] = true;

        while (!vs.empty()) {

            int k = vs.front();

            Triangle triangle;

            triangle.parent = k;



            for (int i : edges[k]) {

                if (check[i]) continue;

                check[i] = true;

                triangle.children.push_back(i);

                vs.push(i);

            }

            vs.pop();

            leafs.push_back(triangle);

        }

//        reverse(leafs.begin(), leafs.end());

    }

};



int main() {

    int n, q;

    cin >> n >> q;



    Tree tree(n);



    rep(i, n - 1) {

        int a, b;

        cin >> a >> b;

        a--;

        b--;

        tree.edge(a, b);

    }



    vector<ll> counter(n, 0);

    rep(i, q) {

        int p;

        ll x;

        cin >> p >> x;

        p--;

        counter[p] += x;

    }



    vector<Triangle> leafs;

    tree.root(0, leafs);



    for (Triangle &t : leafs) {

        for (int child : t.children) {

            counter[child] += counter[t.parent];

        }

    }



    for (ll c : counter) cout << c << ' ';



}


// Fastest known solution for this problem: