#n,q = gets.chomp.to_i
n, q = gets.chomp.split(" ").map(&:to_i);
#s = gets.chomp
#

edges = {}
(n-1).times do 
  from, to = gets.chomp.split(" ").map(&:to_i);
  edges[from] = [] if edges[from].nil?
  edges[from] << to
end

#pp edges

points = {}
q.times do
  p, x = gets.chomp.split(" ").map(&:to_i);
  points[p] = [] if points[p].nil?
  points[p] << x
end

#pp points

stack = [1]
results = Array.new(n+1, 0)
#pp results
while true do
  break if stack.size == 0
  node = stack.shift

  unless points[node].nil?
    points[node].each do |p|
      results[node] += p
    end
  end

  next if edges[node].nil?
  edges[node].each do |to|
    stack << to
    results[to] += results[node]
  end
end

results.shift
puts results.join(" ")