n, q = gets.split(' ').map(&:to_i)

@trees = []
@val = []

(n-1).times.each do
  p, c = gets.split(' ').map(&:to_i)

  @trees[p] ||= []
  @trees[p] << c
  @trees[c] ||= []
  @trees[c] << p
end

q.times.each do
  p, x = gets.split(' ').map(&:to_i)
  @val[p] ||= 0
  @val[p] += x
end

def dfs(u, p)
  @trees[u].each do |v|
    if v != p
      @val[v] ||= 0
      @val[v] += @val[u]
      dfs(v, u)
    end
  end
end

dfs(1, -1)

puts @val.compact.map(&:to_s).join(' ')
