N, Q = gets.split.map(&:to_i)

tree = Array.new(N+1).map{Array.new}

(N-1).times do
    a, b = gets.split.map(&:to_i)
    tree[a].push(b)
end

val = Array.new(N+1, 0)
Q.times do
    pp, x = gets.split.map(&:to_i)
    val[pp] += x
end

ans = Array.new(N+1, 0)
list = [1]
while !list.empty?
    cur = list.pop
    ans[cur] += val[cur]

    tree[cur].each do |x|
        list.push(x)
        ans[x] += ans[cur]
    end
end

ans.shift
puts ans.join(" ")
