N,Q=gets.split.map(&:to_i)

tree = {}
(N-1).times do
  a,b = gets.split.map(&:to_i)
  tree[a] ||= []
  tree[a] << b
  tree[b] ||= []
  tree[b] << a
end

score = Array.new(N+1,0)
Q.times do
  p,x = gets.split.map(&:to_i)
  score[p] += x
end

q = [[1, score[1]]]
until q.empty?
  n, s = q.shift
  next if tree[n].nil?
  score[n] = s
  tree[n].each { |c| q << [c,s+score[c]] }
  tree[n] = nil
end

puts score[1..-1].join(' ')
