import java.util.*; public class d { static short[] 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 short[m+1]; l = new short[m+1]; r = new short[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.nextShort(); r[i] = scan.nextShort(); System.out.print(state[i]); System.out.print(l[i]); System.out.println(r[i]); } //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] = (short) (1 - state[location]); location = newLocation; location = 0; } } //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"); } }