#include using namespace std; void dbg_out() { cerr << endl; } template void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #define dbg(...) cerr << "(" << #__VA_ARGS__ << ")", dbg_out(__VA_ARGS__) #define int long long const int MOD = 1e9 + 7; const int INF = LLONG_MAX >> 1; void solve() { int n, k; cin >> n >> k; pair a[k]; for (int i = 0; i < k; i++) { int x; cin >> x; char c; cin >> c; int y; if (c == 'R') y = 0; if (c == 'G') y = 1; if (c == 'B') y = 2; a[i] = {x, y}; } sort(a, a + k); vector ans(n); for (int i = 0; i < n; i++) { ans[i] = i % 3; } for (int i = 0; i < k; i++) { auto &[x, y] = a[i]; int k = (x - 1) / 3 * 3, ind = -1; bool ok = false; for (int l = k; l < min(k + 3, n); l++) { if (ans[l] == y) { ind = l; ok = true; break; } } if (!ok) { ans[x - 1] = y; } else { swap(ans[x - 1], ans[ind]); } } for (int i = 0; i < n; i++) { if (ans[i] == 0) cout << 'R'; if (ans[i] == 1) cout << 'G'; if (ans[i] == 2) cout << 'B'; } cout << '\n'; } int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tc = 1; // cin >> tc; while (tc--) solve(); }