n = int(input()) bus = [] pair = [] for _ in range(n): bus.append(input()) for t in bus: pair = [] if t.count("G") == t.count("R"): for s in range(len(t)-1,0,-1): if t[s] == "R": pair.append("R") elif t[s] == "G" and len(pair) != 0 and pair.count("R") - pair.count("G") >= 0: pair.append("G") elif t[s] == "W": pass else: print("impossible") break else: print("possible") else: print("impossible")