#include #include #include using namespace std; string solve(string str){ # define OK "possible" # define NG "impossible" int n = str.size(), w=0, g=0, r=0; bool running = false; reverse(str.begin(), str.end()); if(str[0] != 'R') return NG; for(int i=0; i0) --g; } } if(r != 0 || g != 0) return NG; return OK; } int main(){ int n; cin >> n; for(int i=0; i> str; cout << solve(str) << endl; } }