#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#define rep(n) for(int i = 0; i < n; ++i)
using namespace std;
int main(void) {
	int t, s, c = 0;
	cin >> t;
	rep(s) {
		string str;
		cin >> str;
		rep(str.size()) {
			if (str[i] == 'G') {
				++c;
			}
			else if (str[i] == 'R') {
				--c;
			}
			if (c < 0) {
				cout << "impossible" << endl;
				return 0;
			}
		}
		if (c == 0) {
			cout << "possible" << endl;
		}
		else {
			cout << "impossible" << endl;
		}
		return 0;
	}
}