xs = (0..2).map {|i| a, b = gets.split.map(&:to_i); [-a, b, (i + 65).chr] } puts xs.sort.map(&:last)