n, q = gets.split.map(&:to_i)
a = []
b = []
for i in 1..(n - 1) do
  a[i], b[i] = gets.split.map(&:to_i)
end
p = []
x = []
for i in 1..q do
  p[i], x[i] = gets.split.map(&:to_i)
end
node = Array.new(n + 1, 0)
for i in 1..q do
  node[p[i]] += x[i]
end
for i in 1..(n - 1) do
  node[b[i]] += node[a[i]]
end
node.shift
puts node.join(" ")
