<>;map{chomp;$_=reverse;print"im"x!!(/^R*W/||do{1while s/R(R*)G([RG]*)W/"$1$2"/e;/[^W]/}),"possible",$/}<>