h = {"A" => "#{gets}","B" => "#{gets}","C" => "#{gets}"} h = h.sort_by{|k,v| -v} h.each{|k,v| puts k }