n = gets.chomp!.to_i abort unless 1 <=n && n<=150 cstr = gets.chomp! abort unless cstr =~ /^\d+(?: \d+)*$/ abort unless !gets c = cstr.split.map(&:to_i) count = Array.new(4,0) c.each{|e| count[ [3,e].min ] += 1 } if count[1].odd? && count[2]<=1 && count[3]==0 puts 'A' else puts 'B' end