#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>T; while(T--) { cin>>S; int L=S.size(); bool ok=true; int W=0,G=0,R=0; for(i=L-1;i>=0;i--) { if(S[i]=='R') { R++; } if(S[i]=='G') { if(R==0) { ok=false; break; } R--; G++; } if(S[i]=='W') { if(G==0 && W==0) { ok=false; break; } else if(G) { G--; W++; } else { W++; } } } if(G||R) ok=false; if(ok) cout<<"possible"<