dic = {"G": 0, "R": 1, "W": 2} for _ in range(int(input())): S = input() X = [0, 0] for s in S: if dic[s] < 2: X[dic[s]] += 1 if X[1] > X[0]: print("impossible") break else: if X[0] == X[1]: print("possible") else: print("impossible")