#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>s; Int n=s.size(); Int g=0,r=0,w=0; for(Int i=0;i0)){ cout<<"impossible"< a(g,-1),b(g,-1),c(g,-1); for(Int i=n-1,j=g,k=g;i>=0;i--){ if(s[i]=='R') a[--j]=i; if(s[i]=='G') b[--k]=i; } for(Int i=0,j=0;i>T; while(T--) solve(); return 0; }