import java.util.Scanner; public class Main { static Scanner sc=new Scanner(System.in); public static void main(String[] args) { int n=sc.nextInt();//数组长度 int t=sc.nextInt();//操作次数 int arr[]=new int[n]; char arr1[] = new char[t]; int arr2[] = new int[t]; int visited[]=new int[n+1]; for(int i = 0 ;i<t ; i++) { arr1[i]=sc.next().charAt(0); arr2[i]=sc.nextInt(); } //双指针 int i=0; int j=n-1; for(int temp=t-1;temp>=0;temp--) { if(visited[arr2[temp]]==-1)continue; if(arr1[temp]=='R') { arr[j]=arr2[temp]; j--; visited[arr2[temp]]=-1; } if(arr1[temp]=='L') { arr[i]=arr2[temp]; i++; visited[arr2[temp]]=-1; } } int p=1; for(int b=0;b<n;b++) { if(arr[b]==0) { while(visited[p]==-1) { p++; } visited[p]=-1; System.out.print(p+" "); } else System.out.print(arr[b]+" "); } } }