import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int i=0; i0 && gNum>0 && (rNum==gNum)) { } else { System.out.println("impossible"); continue; } int r, g, w; //一番右のGより右にWがあってはだめ g = getCharIndex(S, S.length, 'G'); w = getCharIndex(S, S.length, 'W'); if(g>0 && w>0 && (w g && r > w) && (w < g && w < r) ) { S[r] = S[g] = S[w] = ' '; } else { break; } } rNum = getCharCount(S, 'R'); if(rNum == 0) { System.out.println("possible"); } else { System.out.println("impossible"); } } } static int getCharIndex(char[] list, int edge, char c) { for(int i=edge-1; i>=0; i--) { if(list[i] == c) return i; } return -1; } static int getCharCount(char[] list, char c) { int ret = 0; for(int i=0; i