#include using namespace std; using ll=long long; using ld=long double; using P=pair; using ps=pair; using V=vector; #define rep(i,n) for(int i=0;i> n >> q; V a(n,-1); rep(i,q){ int x; char c; cin >> x >> c; x--; if(c=='R') a[x]=0; if(c=='G') a[x]=1; if(c=='B') a[x]=2; } vector s(n+5,V(3)); rep(i,n){ int m=1e9,M=0; rep(j,3){ M=max(M,s[i][j]); m=min(m,s[i][j]); } bool f=(a[i]==-1); if(!f) if(m