import std.stdio, std.array, std.conv, std.container;

void main() {
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], q = tmp[1];
    int[][] tree = new int[][](n);
    int[] cnt = new int[n];
    foreach (i; 0 .. n-1) {
        tmp = readln.split.to!(int[]);
        int a = tmp[0] - 1, b = tmp[1] - 1;
        tree[a] ~= b;
        tree[b] ~= a;
    }
    foreach (i; 0 .. q) {
        tmp = readln.split.to!(int[]);
        int p = tmp[0] - 1, x = tmp[1];
        cnt[p] += x;
    }
    bool[] flag = new bool[n];
    auto d = DList!int(0);
    while (!d.empty) {
        int v = d.front;
        d.removeFront;
        flag[v] = true;
        foreach (y; tree[v]) {
            if (flag[y]) continue;
            cnt[y] += cnt[v];
            d.insertBack(y);
        }
    }
    foreach (i, y; cnt) {
        y.write;
        if (i != n - 1) " ".write;
        else writeln;
    }
}