=begin
def dfs(i, p)
  cnt = 
    if p
      V[p][:cnt]
    else
      0
    end

  V[i][:cnt] += cnt

  V[i][:link].each do |l|
    next if l == p
    dfs(l, i)
  end
end
=end

N, Q = gets.strip.split(" ").map(&:to_i)
V = Array.new(N) do |i|
  {cnt: 0, link: []}
end

(N - 1).times do
  a, b = gets.strip.split(" ").map(&:to_i)
  a -= 1
  b -= 1

  V[a][:link] << b
  V[b][:link] << a
end

Q.times do
  p, x = gets.strip.split(" ").map(&:to_i)
  V[p - 1][:cnt] += x
end

# dfs(0, nil)

q = [[0, nil]]
while !q.empty? do
  i, p = q.shift
  cnt =
    if p
      V[p][:cnt]
    else
      0
    end

  V[i][:cnt] += cnt

  V[i][:link].each do |l|
    next if l == p
    q << [l, i]
  end
end

ans = ""
V.each do |v|
  if ans.empty?
    ans << v[:cnt].to_s
  else
    ans << " #{v[:cnt]}"
  end
end

puts ans
