n, q = gets.split.map(&:to_i)
a = Array.new
b = Array.new
p = Array.new
x = Array.new

1.upto(n-1) do |i|
  ai, bi = gets.split.map(&:to_i)
  a[i] = ai
  b[i] = bi
end

1.upto(q) do |i|
  pi, xi = gets.split.map(&:to_i)
  p[i] = pi
  x[i] = xi
end

points = Array.new(n + 1, 0)
p.each_with_index do |node, i|
  next if i == 0
  points[node] += x[i]
end

points.each_with_index do | point, i|
  next if i == 0
end

target = [ 1 ]
loop do
  next_targets = []
  a.each_with_index do |node, i|
    next if i == 0
    target.each do |t|
      if t == node
        next_targets.push b[i]
        points[b[i]] += points[t]
      end
    end
  end
  target = next_targets
  break if target.empty?
end

points.shift
puts "#{points.join(" ")}\n"
