package main import ( "fmt" ) func solve() (res string) { res = "impossible" var S string fmt.Scan(&S) var W, G, R int for _, r := range S { switch r { case 'W': W++ case 'G': if W == 0 { return } W = 0 G++ case 'R': R++ } if R > G { return } } if W == 0 && G == R { res = "possible" } return } func main() { var N int fmt.Scan(&N) for i := 0; i < N; i++ { fmt.Println(solve()) } }