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