n, q = gets.chomp.split.map(&:to_i)
h = []
ans = Array.new(n, 0)
(n-1).times do |i|
  h[i] = gets.chomp.split.map(&:to_i)
end

q.times do
  a, b = gets.chomp.split.map(&:to_i)
  ans[a-1] += b
end

def count(from, to, h, ans)
  ans[to-1] += ans[from-1]
  h.each do |hh|
    if hh[0] == to
      count(to, hh[1], h, ans)
    end
  end
end

count(0, 1, h, ans)
puts ans.join(' ')
