gets $<.map{|s| h={?R=>0,?G=>0,?W=>0} w=r=g=0; s.chop.reverse.chars{|c| h[c]+=1; r,g,w=h.values g0&&r==g&&g<=w)?:possible:'impossible' }