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); int n = scan.nextInt(); 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(); } //Run simulation for (int i = 1; i <= n; i++) { int location = 1; int newLocation = 0; while (location != 0) { if (state[location] == 0) newLocation = l[location]; else newLocation = r[location]; state[location] = 1 - state[location]; location = newLocation; } } //Print answer for (int i = 1; i <= m; i++) { if (state[i] == 0) System.out.print("L"); else System.out.print("R"); } System.out.print("\n"); } }