gets $<.map{|s| W=R=G=0; s.chop.reverse.chars{|c| c==?W&&W+=1 c==?R&&R+=1 c==?G&&G+=1 (R0&&R==G&&G<=W)?:possible:'impossible' }