n, q = gets.split.map(&:to_i)
edge = []
for i in 0...(n - 1) do
  a, b = gets.split.map(&:to_i)
  edge[i] = [a, b]
end
edge.sort! do |e, f|
  e[0] <=> f[0]
end
p = []
x = []
for j in 0...q do
  p[j], x[j] = gets.split.map(&:to_i)
end
node = Array.new(n, 0)
for j in 0...q do
  node[p[j] - 1] += x[j]
end
for i in 0...(n - 1) do
  node[edge[i][1] - 1] += node[edge[i][0] - 1]
end
puts node.join(" ")
