#include typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ int N; cin >> N; for(int i = 0;i < N;i++){ string S; cin >> S; reverse(S.begin(),S.end()); int rcnt = 0,gcnt = 0; for(char c:S){ if(rcnt < gcnt)break; if(c == 'R')rcnt++; if(c == 'G')gcnt++; if(c == 'W' && (rcnt == 0 || gcnt == 0)){rcnt = -1;break;} } if(rcnt != gcnt)cout << "impossible" << endl; else cout << "possible" << endl; } }