N, Q = gets.chomp.split(" ").map(&:to_i)
C = Hash.new{|h, k| h[k] = []}
(N - 1).times{
  a, b = gets.chomp.split(" ").map(&:to_i)
  C[a] << b
  C[b] << a
}
ans = Array.new(N + 1, 0)
Q.times{|q|
  p, x = gets.chomp.split(" ").map(&:to_i)
  ans[p] += x
}

stk = [[0, 1]]
until stk.empty? do
  pa, ch = stk.pop
  ans[ch] += ans[pa]
  C[ch].each do |gr|
    next if gr == pa
    stk.push([ch, gr])
  end
end

ans.shift
puts ans.join(' ')
