h=Hash.new 0 gets $<.each_slice(3){|_,m,s|s.split{h[_1]+=m[/ .*/].to_i}} h.sort_by{[-_2,_1]}[0,10].map{puts _1*" "}