#include #include using namespace std; typedef pair P; int main() { int n, k; cin >> n >> k; P p[200005]; for (int i = 0; i < k; i++) { cin >> p[i].first >> p[i].second; } sort(p, p + k); p[k] = P(n, 'R'); p[k + 1] = P(n, 'G'); p[k + 2] = P(n, 'B'); int d[3]{0}; string ans; for (int i = 0; i < k + 3; i++) { while (d[(int)p[i].second % 3] < (p[i].first + 2) / 3) { ans += p[i].second; d[(int)p[i].second % 3]++; } } cout << ans.substr(0, n) << endl; }