puts [*0..2].map.with_index{|n,i| a=gets.split.map(&:to_i) "#{a[0]}#{1100-a[1]}#{%w(A B C).at(i)}" }.sort.reverse.map{|n|n.slice(-1)}