from cmath import inf n,k = map(int,input().split()) ans = [] RGB = [0]*3 AC = [] for i in range(k): a,c = input().split() a = int(a) AC.append([a,c]) AC.sort() l = "RGB" now = 0 for i in range(1,n+1): target = 0 ind = -1 if now < k and AC[now][0] == i: c = AC[now][1] ind = l.index(c) if max(RGB) == RGB[ind]: if RGB.count(max(RGB)) == 3: target = ind else: for j in range(3): if RGB[j] != max(RGB): target = j break else: target = ind now += 1 else: for j in range(3): if RGB[j] != max(RGB): target = j break ans.append(target) RGB[target] += 1 assert max(RGB)-min(RGB) <= 1 if ind != -1 and max(RGB) != RGB[ind]: print(-1) exit() ans = [l[i] for i in ans] print("".join(ans))