"use strict"

function Main(input) {
    const N = parseInt(input[0], 10);
    const Q = parseInt(input[1], 10);
    const ab = input.slice(2, (N - 1) * 2 + 2).map(n =>{
        return parseInt(n, 10);
    });
    const px = input.slice((N - 1) * 2 + 2).map(n =>{
        return parseInt(n, 10);
    });

    let nodeList = [0];
    for (let i = 0; i < ab.length; i = i + 2) {
        nodeList[ab[i + 1] - 1] = ab[i];
    }

    let addList = new Array(N);
    addList.fill(0);
    for (let i = 0; i < px.length; i = i + 2) {
        addList[px[i] - 1] += px[i + 1];
    }

    let result = new Array(N);
    for (let i = 0; i < N; i++) {
        if (i === 0) {
            result[i] = addList[i];
        } else {
            result[i] = result[nodeList[i] - 1] + addList[i];
        }
    }

    console.log(result.join(' '));

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));
