<>;map{$_=reverse;$i++while s/^\s*R(R*)G((R*G[RG]*)W|([RW]*)W)/$1.$3.$4=~y#W##dr/e;$i=!print"im"x!($i&&!$_),possible,$/}<>