import java.util.*; public class d { static int[] state, l, r; static List original, topoSort; public static void main(String[] args) { //Read input Scanner scan = new Scanner(System.in); long n = scan.nextLong(); int m = scan.nextInt(); state = new int[m+1]; l = new int[m+1]; r = new int[m+1]; for (int i = 1; i <= m; i++) { char inState = scan.next().charAt(0); if (inState == 'L') state[i] = 0; else if (inState == 'R') state[i] = 1; else System.out.println("ERRRRORRROR"); l[i] = scan.nextInt(); r[i] = scan.nextInt(); /*System.out.print(state[i]); System.out.print(l[i]); System.out.println(r[i]);*/ } //Topological sort original = new LinkedList(); for (int i=1; i <= m; i++) original.add(i); topoSort = new LinkedList(); while (!original.isEmpty()) { visit(original.get(0)); } //System.out.println(topoSort); //Calculate counts long[] counts = new long[m+1]; for (int i = 0; i <= m; i++) counts[i] = 0; counts[1] = n; for (Integer i : topoSort) { if (counts[i] % 2 == 0) { counts[l[i]] += counts[i] / 2; counts[r[i]] += counts[i] / 2; } else { if (state[i] == 0) { counts[l[i]] += counts[i] / 2 + 1; counts[r[i]] += counts[i] / 2; } else { counts[l[i]] += counts[i] / 2; counts[r[i]] += counts[i] / 2 + 1; } } } //Print answer StringBuilder answer = new StringBuilder(); for (int i = 1; i <= m; i++) { //if ((state[i] + counts[i]) % 2 == 0) //if ((state[i] % 2) == (counts[i] % 2)) long x = counts[i] % 2; long y = counts[i] % 2; if (x == y) answer.append('L'); else answer.append('R'); } System.out.println(answer); } public static void visit(int i) { if (i == 0) return; if (!topoSort.contains(new Integer(l[i]))) visit(l[i]); if (!topoSort.contains(new Integer(r[i]))) visit(r[i]); Integer toRemove = new Integer(i); if (original.contains(toRemove)) original.remove(toRemove); topoSort.add(0, i); } }