import java.util.*; public class d { static int[] state, l, r; 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(); } //Topological sort LinkedList L = new LinkedList(); LinkedList S = new LinkedList(); /*for (int i = 1; i <= m; i++) { boolean source = true; for (int j = 1; j <= m; j++) { if (l[j] == i || r[j] == i) source = false; } if (source) S.add(i); }*/ S.add(1); while (S.size() > 0) { int popped = S.pop(); if (L.contains(popped)) L.remove(new Integer(popped)); L.add(popped); //System.out.println(popped); //Check right boolean source = true; for (int j = 1; j <= m; j++) { if ((l[j] == r[popped] && !S.contains(j) && !L.contains(j)) || (r[j] == r[popped] && !S.contains(j) && !L.contains(j))) { source = false; } } if (source && r[popped] != 0) S.add(r[popped]); //Check left source = true; for (int j = 1; j <= m; j++) { if ((l[j] == l[popped] && !S.contains(j) && !L.contains(j)) || (r[j] == l[popped] && !S.contains(j) && !L.contains(j))) { source = false; } } if (source && l[popped] != 0) S.add(l[popped]); } //System.out.println(Arrays.toString(L.toArray())); //Calculate counts long[] counts = new long[m+1]; for (int i = 0; i <= m; i++) counts[i] = 0; counts[1] = n; for (Integer i : L) { 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) answer.append("L"); else answer.append("R"); if (answer.length() > 1000) { System.out.print(answer); answer.setLength(0); } } System.out.println(answer); } }