#include using namespace std; #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) _repi(i,0,n) #define _repi(i,a,b) for(int i=int(a);i> s; int w = 0, g = 0; for (char c : s) { if (c == 'W') { w = 1; } else if (c == 'G') { w = 0, ++g; } else if (c == 'R') { --g; } if (g < 0) return false; } return w == 0 and g == 0; } int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int t; for (cin >> t; t--; ) { cout << (solve() ? "possible" : "impossible") << endl; } }