#include #define LL long long #define ULL unsigned long long #define REP(i,n) for(int i=0; i<(n); i++) #define REP2(i,x,n) for(int i=x; i<(n); i++) using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string S; REP( i, N ) { cin >> S; auto pos = S.find_last_of( 'R' ); if( S.find( 'G', pos + 1 ) != string::npos || S.find( 'W', pos + 1 ) != string::npos ) { cout << "impossible" << endl; continue; } int countG{},countR{}; REP( i, (int)S.size() ) { if( S[i] == 'G' ) { countG++; } if( S[i] == 'R') { countR++; } } cout << ( (countG > 0 && countR > 0 ) ? "possible" : "impossible" ) << endl; } return 0; }