#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) struct Edge{ int to,i; }; struct Edge2{ int u,v; }; int N,M; vector> E,rE; vector J; vector D; vector B; void bfs(int s){ D.assign(N,-1); queue Q; D[s]=0; Q.push(s); while(Q.size()){ int p=Q.front(); Q.pop(); for(auto e:E[p]) if(D[e.to]==-1){ D[e.to]=D[p]+B[e.i]; Q.push(e.to); } } } int main(){ scanf("%d%d",&N,&M); E.resize(N); rE.resize(N); J.resize(M); rep(i,M){ int u,v; scanf("%d%d",&u,&v); u--; v--; E[u].push_back({v,i}); rE[v].push_back({u,i}); J.push_back({u,v}); } int cyd=1000000, cys=-1, cyt=-1, cye=-1; B.assign(M,1); rep(s,N){ bfs(s); for(auto e:rE[s]){ if(D[e.to]%2==0) if(D[e.to] Cy, Cye; Cy.push_back(cys); Cye.push_back(cye); bfs(cys); while(cyt!=cys){ Cy.push_back(cyt); for(auto e:rE[cyt]) if(D[e.to]0) ok=true; } if(!ok){ printf("-1\n"); return 0; } rep(i,M) printf((B[i]==1)?"R":"G"); printf("\n"); return 0; }