import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val n = nextInt() val k = nextInt() val map = mutableMapOf() for (i in 0 until k) { val a = nextInt() val c = next() map[a - 1] = c[0] } val ans = CharArray(n) { '.' } for (i in 0 until n) { if (i % 3 == 0) { if (map.containsKey(i)) { val c = map[i]!! ans[i] = c } else { ans[i] = 'R' } } else if (i % 3 == 1) { if (map.containsKey((i))) { val c = map[i]!! if (ans[i - 1] == c) { ans[i] = if (c == 'R') 'G' else 'R' } else { ans[i] = c } } else { ans[i] = if (ans[i - 1] == 'R') 'G' else 'R' } } else { val lst = mutableListOf('R', 'G', 'B') lst.remove(ans[i - 1]) lst.remove(ans[i - 2]) ans[i] = lst[0] } } println(ans.joinToString("")) } fun main() { Thread(null, { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() }, "solve", abs(1L.shl(26))) .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } } .apply { start() }.join() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion