#include<bits/stdc++.h>
#define ll long long
#define P pair<ll, ll>
using namespace std;

int seen[200001] = {0};
int cnt[200001] = {0};
vector<vector<int>> g;

void dfs(vector<int>x, int e){
    seen[e] = 1;
    for(auto ne:g[e]){
        if(seen[ne] > 0) continue;
        cnt[ne] = cnt[e] + x[ne];
        dfs(g, x, ne, cnt);
    }
}

int main(){
    int n, q;
    cin >> n >> q;
    g.resize(n);
    for(int i=0;i<n-1;i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int>x(n, 0);
    for(int i=0;i<q;i++){
        int p, tmp;
        cin >> p >> tmp;
        x[p-1] += tmp;
    }

    cnt[0] = x[0];
    dfs(x, 0);

    for(int i=0;i<n;i++) cout << cnt[i] << " ";
    cout << endl;
}