n, k = read_line.split.map(&.to_i) cs = Array.new(n, -1) k.times do a, c = read_line.split cs[a.to_i - 1] = "RGB".index(c).not_nil! end ans = [] of Int32 cnt = [0, 0, 0] n.times do |i| min = 3.times.min_by { |i| cnt[i] } case i % 3 when 0 ans << (cs[i] == -1 ? 0 : cs[i]) when 1 if cs[i] == -1 ans << min else ans << (ans[-1] == cs[i] ? min : cs[i]) end when 2 ans << min end cnt[ans[-1]] += 1 end puts ans.map { |i| "RGB"[i] }.join