print@$_[2],$/for sort{"@$b"-"@$a"||@$a[1]-@$b[1]}map[glob(<>),$_],A..C