import std.conv, std.stdio;
import std.algorithm, std.array, std.range, std.string;

void main()
{
    auto buf = readln.chomp.split.to!(int[]);
    auto tree = Tree(buf[0]);
    immutable q = buf[1];
    foreach (i; 1..tree.length)
    {
        buf = readln.chomp.split.to!(int[]);
        tree.addEdge(buf[0], buf[1]);
    }
    foreach (i; 0..q)
    {
        buf = readln.chomp.split.to!(int[]);
        tree[buf[0]-1].countUp(buf[1]);
    }
    "%(%d %)".writefln(tree.dfs);
}
struct Tree
{
    Node[] nodes;
    this (in size_t n)
    {
        nodes.length = n;
        nodes[0] = root;
        foreach (i; 1..n)
            nodes[i] = node;
    }
    void addEdge(in size_t a1, in size_t b1)
    {
        auto a = nodes[a1-1], b = nodes[b1-1];
        a.children ~= b1-1;
        assert (b.parent is null);
        b.parent = a;
    }
    alias nodes this;
    ulong[] dfs()
    {
        auto result = new ulong[nodes.length];
        auto visited = new bool[nodes.length];
        void _dfs(size_t p, long counter)
        {
            counter += nodes[p].counter;
            result[p] = counter;
            assert (!visited[p]);
            visited[p] = true;
            stderr.writefln("visit: %d", p);
            foreach (c; nodes[p].children)
                _dfs(c, counter);
        }
        _dfs(0, 0);
        assert (visited.all);
        return result;
    }
}
class Node
{
    bool isRoot;
    Node parent;
    size_t[] children;
    this (bool isRoot, Node parent, size_t[] children)
    {
        this.isRoot = isRoot;
        this.parent = parent;
        this.children = children;
    }
    long counter;
    void countUp(long x)
    {
        this.counter += x;
    }
}
auto root()
{
    return new Node(true, null, []);
}
auto node()
{
    return new Node(false, null, []);
}
