N = int(input()) P = [input() for _ in range(N)] for pat in P: wcount = 0 gcount = 0 for i in range(len(pat)): if pat[i] == 'W': wcount += 1 if pat[i] == 'G': gcount += 1 if wcount < gcount: print('impossible') break if pat[i] == 'R': if wcount < 1 or gcount < 1: print('impossible') break wcount -= 1 gcount -= 1 else: if pat[-1] != 'R' or 'W' in pat[::-1][:pat[::-1].index('G')]: print('impossible') else: print('possible')