io = STDIN
N,Q=io.gets.split.map(&:to_i)
ar=Array.new(N+1,0)
rv=Array.new(N+1,nil)
(N-1).times do
  rt,lf=io.gets.split.map(&:to_i)
  rv[lf]=rt
end
Q.times do
  p1,x=io.gets.split.map(&:to_i)
  ar[p1]+=x
end

ar.each_with_index do |v,i|
  next if i==0
  ans=v
  j=i
  while rt=rv[j]
    ans+=ar[rt]
    j=rt
  end
  print ans.to_s
  print " " if i < N
end
