import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n, q;
    readf("%s %s", &n, &q);
    readln;
    
    auto g = new int[][] (n+1);
    foreach (i; 0 .. n-1) {
        int u, v;
        readf("%s %s", &u, &v);
        readln;
        
        g[u] ~= v;
        g[v] ~= u;
    }
    
    auto s = new int[] (n+1);
    foreach (_; 0 .. q) {
        int p, v;
        readf("%s %s", &p, &v);
        readln;
        
        s[p] += v;
    }
    
    debug { s.writeln; }
    
    auto ans = new int[] (n+1);
    
    void dfs(int v, int fr, int add) {
        ans[v] = s[v] + add;
        
        foreach (u; g[v]) {
            if (u == fr) { continue; }
            
            dfs(u, v, add + s[v]);
        }
    }
    
    dfs(1, -1, 0);
    
    for (int i = 1; i <= n; ++i) {
        if (i > 1) { write(' '); }
        write(ans[i]);
    }
    writeln();
}