N = int(input()) P = [input() for _ in range(N)] for pat in P: if 'W' not in pat or 'G' not in pat or 'R' not in pat: print('impossible') continue p = pat[:] for i in range(len(pat)): if pat[i] == 'G': if 'W' not in p[:i]: print('impossible') break p = p[:i].replace('W', 'X', 1) + p[i:] if 'R' not in p[i+1:]: print('impossible') break p = p[:i+1] + p[i+1:].replace('R', 'S', 1) else: if p[-1] != 'S' or 'R' in p or 'W' in p[::-1][:p[::-1].index('G')]: print('impossible') else: print('possible')