x,z,t,s;main(i){for(;read(0,&z,1)?z==10?s=t=--i&&!puts("impossible"+2*!(t|s<0|x-71)):z-82?x=z,z-87?s--,~t&&t++:~s&&s++:t--,1:0;);}