n, q = gets.split.map(&:to_i)
a = (n-1).times.map{gets.split.map(&:to_i)}
p, x = q.times.map{gets.split.map(&:to_i)}.transpose
node = Array.new(n, 0)
a.sort! { |a, b| a[1] <=> b[1] }

(0..(q-1)).each do |i|
  node[p[i] - 1] += x[i]
end

(0..(n-2)).each do |i|
  node[a[i][1] - 1] += node[a[i][0] - 1]
end

puts node.join(' ')