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: flag = 'W' in pat[::-1][:pat[::-1].index('G')] if pat[-1] != 'R' or gcount != 0 or flag: print('impossible') else: print('possible')