N, Q = gets.split.map(&:to_i)
adj = Array.new(N + 1) {Array.new}
(N-1).times do
    a, b = gets.split.map(&:to_i)
    adj[a] << b
    adj[b] << a
end
add = Array.new(N + 1, 0)
Q.times do
    pj, xj = gets.split.map(&:to_i)
    add[pj] += xj
end
visited = Array.new(N + 1, false)
count = Array.new(N + 1, 0)
stack = [[1, 0]]
visited[1] = true
while !stack.empty?
    current_p, parent_count = stack.pop
    count[current_p] = parent_count + add[current_p]
    adj[current_p].each do |next_p|
        if !visited[next_p]
            visited[next_p] = true
            stack.push([next_p, count[current_p]])
        end
    end
end
puts count[1..-1].join(" ")