#include #include using namespace std; typedef long long ll; const int INF = 1<<30; const ll INFLL = 1LL<<60; const ll MOD = 998244353; const double INFD = 1.0E18; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, -1, 0, 1}; //const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1}; //const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; //const int dx[8] = {2, 1, -1, -2, -2, -1, 1, 2}; //const int dy[8] = {1, 2, 2, 1, -1, -2, -2, -1}; using Pair = pair; using Graph = vector>>; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int n, m; cin >> n >> m; Graph G(n); bool ok = true; for (int i = 0; i < m; i++){ int u, v; cin >> u >> v; u--; v--; if (u == 0 && v == n - 1) ok = false; G[u].push_back({v, i}); G[v].push_back({u, i}); } if (m % 2 == 1 || ok == false){ cout << -1 << endl; return 0; } atcoder::dsu uf(n); vector ans(m, 'B'); int x = 0; if (G[0].size() > m / 2) x = n - 1; queue q; for (auto [v, idx] : G[x]){ ans[idx] = 'R'; q.push(v); uf.merge(x, v); } int rem = m / 2 - G[x].size(); while (!q.empty()){ if (rem == 0) break; int v = q.front(); q.pop(); for (auto [nv, idx] : G[v]){ if (nv == n - 1 - x) continue; if (ans[idx] == 'R') continue; uf.merge(v, nv); ans[idx] = 'R'; rem--; if (rem == 0) break; q.push(nv); } } queue q2; q2.push(n - 1 - x); while (!q2.empty()){ if (rem == 0) break; int v = q2.front(); q2.pop(); for (auto [nv, idx] : G[v]){ if (uf.same(nv, x)) continue; if (ans[idx] == 'R') continue; ans[idx] = 'R'; rem--; if (rem == 0) break; q2.push(nv); } } for (int i = 0; i < m; i++) cout << ans[i]; cout << endl; return 0; }