using System; class Bus { static public void Main(String[] args) { int T = int.Parse(Console.ReadLine()); for(int i=0; i < T; i++) { string S = Console.ReadLine(); if(S.Length < 3) { Console.WriteLine("impossible"); continue; } int count = 0; foreach(char s in S) { if(s == 'G') { count++; } else if(s == 'R') { if(--count < 0) { Console.WriteLine("impossible"); break; } } } if(count == 0) { Console.WriteLine("possible"); } else if(count > 0) { Console.WriteLine("impossible"); } } } }