n, q = gets.split.map &:to_i
Vertex = Struct.new(:count, :connected)
vertexes = n.times.map {Vertex[0, []]}
(n-1).times do
  a, b = gets.split.map &:to_i
  vertexes[a-1].connected << b-1
  vertexes[b-1].connected << a-1
end
q.times do
  p, x = gets.split.map &:to_i
  vertexes[p-1].count += x
end

def search(i, value, graph, parent = 0)
  node = graph[i]
  v = node.count += value
  node.connected.each { |j| search(j, v, graph, i) if j != parent }
end
search 0, 0, vertexes
puts vertexes.map { |v| v.count }.join(" ")