#include using namespace std; using ll = long long; int main(){ int n, k, p; char c; cin >> n >> k; vector>> tb(3); for(int i = 0; i < k; i++){ cin >> p >> c; p--; tb[p % 3].emplace_back(p, c); } string ans(n, '?'); for(int i = 0; i < tb[0].size(); i++){ tie(p, c) = tb[0][i]; if(ans[p] != '?'){ cout << -1 << '\n'; continue; } ans[p] = c; } for(int i = 0; i < tb[1].size(); i++){ tie(p, c) = tb[1][i]; if(ans[p - 1] == c)continue; if(ans[p] == c)continue; if(ans[p - 1] == '?')ans[p - 1] = c; else if(ans[p] == '?')ans[p] = c; else{ cout << -1 << '\n'; return 0; } } for(int i = 0; i < n; i += 3){ set S{'R','G','B'}; for(int j = 0; j < 2; j++){ if(ans[i + j] != '?')S.erase(ans[i + j]); } int j = i + 2; while(!S.empty()){ if(j < ans.size())ans[j--] = *S.rbegin(); else j--; S.erase(*S.rbegin()); } } cout << ans << endl; }