import java.util.*; public class Exercise129{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 0; i < n; i++){ judge(sc.next()); } } private static void judge(String s){ char[] sa = s.toCharArray(); if(sa[sa.length - 1] != 'R' || sa[sa.length - 2] == 'W'){ impossible(); return; } for(int i = sa.length - 1; i >= 0; i--){ if(sa[i] == 'R'){ boolean isGExist = false; for(int j = i - 1; j >= 0; j--){ if(sa[j] == 'G'){ isGExist = true; sa[j] = 'x'; boolean isWExist = false; for(int k = j - 1; k >= 0; k--){ if(sa[k] == 'W'){ isWExist = true; sa[k] = 'x'; break; }else if(k == 0 && !isWExist){ impossible(); return; } } break; }else if(j == 0 && !isGExist){ impossible(); return; } } } } System.out.println("possible"); } private static void impossible(){ System.out.println("impossible"); } }