N, Q = gets.split.map(&:to_i)
merge_arrs = (N-1).times.map{gets.split.map(&:to_i)}
add_base_points = Q.times.map{gets.split.map(&:to_i)}

base_points = Array.new(N + 1, 0)
add_base_points.each do |pos, point|
  base_points[pos] += point
end

parents = Array.new(N + 1, nil)
parents[0] = 0
parents[1] = 0
merge_arrs.each do |parent, child|
  parents[child] = parent
end

points = Array.new(N + 1, 0)
(1..N).each do |i|
  points[i] = points[parents[i]] + base_points[i]
end

points.shift
puts points.join(' ')