#include using namespace std; typedef pair P; typedef pair> PP; typedef long long ll; const double EPS = 1e-8; const int INF = 1e9; const int MOD = 1e9+7; int dy[] = {0,1,0,-1}; int dx[] = {1,0,-1,0}; bool ok(string s){ int w,g; w = g = 0; int last = -1; for(int i=s.size()-1;i>=0;i--)if(s[i] == 'G'){last = i;break;} if(s.size() < 3)return false; for(int i=0;i> n; for(int i=0;i> s; if(ok(s))cout << "possible" << endl; else cout << "impossible" << endl; } return 0; }