<>;print"@{[sort{$a-$b}glob<>]}"=~/^(0 )*1( 1 1)*( 2)?$/?A:B