void main()
{
    long n, q;
    rdVals(n, q);

    long[][] tree = new long[][](n);
    foreach (i; 0 .. n-1)
    {
        long a, b;
        rdVals(a, b);
        --a, --b;
        tree[a] ~= b, tree[b] ~= a;
    }

    long[] lists = new long[n];
    foreach (i; 0 .. q)
    {
        long p, x;
        rdVals(p, x);
        --p;
        lists[p] += x;
    }

    bool[] ok = new bool[n];
    long[] que;
    que ~= 0;
    while (!que.empty)
    {
        long f = que[0];
        que.popFront;
        ok[f] = true;
        foreach (t; tree[f])
        {
            if (ok[t]) continue;
            lists[t] += lists[f];
            que ~= t;
        }
    }

    foreach (i, l; lists)
    {
        l.write;
        if (i == n - 1) writeln;
        else " ".write;
    }
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;