#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

vector<vector<int>> N(200001, vector<int> (0));
vector<int> count(200001);
int n;

void Tree_make(int u, int v) {
    N[u].push_back(v);
}

void counter_assign(int u, long w) {
    count[u] = count[u] + w;

    for ( int i = 0; i < N[u].size(); i++ ) {
        int v = N[u][i];
        counter_assign(v, count[u]);
    }
}

int main() {
    int u, v, q;
    int w;

    scanf("%d %d", &n, &q);
    for ( int i = 0; i < n - 1; i++ ) {
        scanf("%d %d", &u, &v);
        Tree_make(u, v);
    }

    for ( int i = 0; i < n; i++ ) {
        count[i] = 0;
    }

    for ( int i = 0; i < q; i++ ) {
        scanf("%d %d", &u, &w);
        count[u] = count[u] + w;
    }

    counter_assign(1, 0);

    for ( int i = 1; i < n + 1; i++ ) {
        printf("%d ", count[i]);
    }

    cout << endl;
    
    return 0;
}