# a : 現在の頂点
# count_arr : count_arr
# mae : 一つ前の値
def kasan(hash,n,a,count_arr,mae)
  if(hash[a.to_s] == nil) then
    return count_arr
  else
    hash[a.to_s].each{|m|
      count_arr[m] += mae
      count_arr = kasan(hash,n,m,count_arr,count_arr[m])
    }
    return count_arr
  end
end

n,q = gets.chomp.split(" ").map{|i|i=i.to_i}
#pp n
#pp q
a=[]
b=[]
h = {}
n.times{|i|
  h[i.to_s] = []
}
(n-1).times{|i|
  arr = gets.chomp.split(" ").map{|i|i=i.to_i}
  a_<<arr[0]
  b<<arr[1]
  h[(a_[i]-1).to_s] << (b[i]-1)
}



#pp h
#pp a
#pp b
p=[]
x=[]
q.times{|i|
  arr = gets.chomp.split(" ").map{|i|i=i.to_i}
  p<<arr[0]
  x<<arr[1]
}


#q.times{|i|h[p[].to_s] = }


count_arr = Array.new(n,0) # 最終的な値が入る

q.times{|i|
  count_arr[p[i]-1] += x[i]
}

#pp count_arr

count_arr = kasan(h,n,0,count_arr,count_arr[0])

puts count_arr.join(" ")