#require 'pp'

n, q = gets.chomp!.split(" ").map(&:to_i)
$tree = {}
mapping = {}
parents = { 1 => -1}
(n - 1).times do |i|
    a, b = gets.chomp!.split(" ").map(&:to_i)
    $tree[a] ||= {}
    $tree[a][b] = 0

    parents[b] = a
end

scores = {}
n.times do |i|
    scores[i+1] = 0
end

operations = []
q.times do |q|
    p, x = gets.chomp!.split(" ").map(&:to_i)
    operations << [p, x]
end

operations.each do |o, x|
    scores[o] += x
end

#pp scores
#pp $tree
ans = {}
tmp = [1]
while tmp.empty?.!
    d = tmp.pop
    ans[d] = scores[d]

    if $tree[d]
        $tree[d].each do |k, _|
            scores[k] += scores[d]
            tmp.push(k)
        end
    end
end

puts ans.sort.map {|x, y| y }.join(" ")
