n, q = gets.split.map(&:to_i)

ab = Hash.new{|hash, key| hash[key] = []}
(n - 1).times do
  a, b = gets.split.map(&:to_i)
  ab[b] << a
end

counts = Array.new(n + 1, 0)
q.times do
  p, x = gets.split.map(&:to_i)
  counts[p] += x
end

def calc_sum(sums, counts, ab, i)
  if sums[i] == -1
    sums[i] = counts[i] + ab[i].inject(0){|result, j| result += calc_sum(sums, counts, ab, j)}
  end
  sums[i]
end

sums = Array.new(n + 1, -1)
ans = []
(1..n).each do |i|
  ans << calc_sum(sums, counts, ab, i)
end
puts ans.join(' ')
