gets C = gets.split.map(&:to_i).reject { |v| v == 0 } C[C.find_index(2)] = 1 if !C.find_index(2).nil? if !C.all? { |v| v == 1 } || C.size & 1 puts ?B else puts ?A end