#include<bits/stdc++.h>
#define int long long
using namespace std;
int lhs[100005],rhs[100005];
int lc=0,rc=0;
int nb=0;
signed main(){
int n;
cin>>n;
while (n--){
char a,b;
cin>>a>>b;
if (a=='A' and b=='L'){
lhs[++lc]=++nb;
}
else if (a=='A' and b=='R'){
rhs[++rc]=++nb;
}
else if (a=='D' and b=='L'){
int k;
cin>>k;
lc-=k;
}
else if (a=='D' and b=='R'){
int k;
cin>>k;
rc-=k;
}
}
for (int i=lc;i>=1;i--){
cout<<lhs[i]<<endl;
}
for (int i=1;i<=rc;i++){
cout<<rhs[i]<<endl;
}
return 0;
}
90pts第一个点WA求调