<>;map{$$_++,$i||=$R<$G||$G<$W&&$W--&&!$G for reverse=~/./g;$i=$R=$G=$W=!print$i||$R-$G||$W<$R?im:"",possible,$/}<>