import java.util.*; public class d { static int[] state, l, r, incoming; 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]; incoming = 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(); incoming[l[i]]++; incoming[r[i]]++; } //System.out.println(Arrays.toString(incoming)); //Topological sort LinkedList L = new LinkedList(); LinkedList S = new LinkedList(); for (int i = 1; i <= m; i++) if (incoming[i] == 0) S.add(i); while (S.size() > 0) { int popped = S.pop(); L.add(popped); incoming[l[popped]]--; if (incoming[l[popped]] == 0) S.add(l[popped]); incoming[r[popped]]--; if (incoming[r[popped]] == 0) S.add(r[popped]); } //System.out.println(Arrays.toString(L.toArray())); //Calculate counts long[] counts = new long[m+1]; 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"); } System.out.println(answer); } }