#!/usr/bin/env python #coding:utf8 def read(): return raw_input() def work(s): chList = "WGR" val = [0, 0, 0] for ch in s: val[chList.find(ch)] += 1 if not (val[0] >= val[1] >= val[2]): print "impossible" return print "possible" if val[0] >= val[1] and val[1] == val[2] else "impossible" if __name__ == "__main__": for i in range(input()): work(read())