// WA #include #include #include using namespace std; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N, K; cin >> N >> K; const string RGB = "RGB"; string target(N, '_'); while (K--) { int i; char c; cin >> i >> c; target[i - 1] = c; } string ret; string rem; for (int i = 0; i < N; ++i) { if (i % 3 == 0) rem = RGB; auto addchar = [&](char c) -> void { ret += c; auto itr = std::find(rem.begin(), rem.end(), c); rem.erase(itr); }; if (count(rem.begin(), rem.end(), target[i])) { addchar(target[i]); } else { char c = rem.front(); addchar(c); } } cout << ret + "R" << endl; }