puts Array.new(3) {|i| gets.split.map(&:to_i) + ["ABC"[i]] }.sort_by{|x| [-x[0], x[1], x[2]]}.map{|x| x[2]}