import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long N, Q;
    scan(N, Q);
    auto G = new long[][](N);
    foreach (_; 0 .. N - 1)
    {
        long a, b;
        scan(a, b);
        a--, b--;
        G[a] ~= b;
        G[b] ~= a;
    }
    auto counter = new long[](N);
    foreach (_; 0 .. Q)
    {
        long p, x;
        scan(p, x);
        p--;
        counter[p] += x;
    }
    auto visited = new bool[](N);
    auto Queue = new DList!long();
    Queue.insertBack(0);
    while (!Queue.empty())
    {
        long v = Queue.front();
        Queue.removeFront();
        visited[v] = true;
        foreach (child; G[v])
            if (!visited[child])
            {
                counter[child] += counter[v];
                Queue.insertBack(child);
            }
    }
    counter.map!(to!string).join(' ').writeln();
}
