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