#include<stdio.h>
int main(){
int number;
while(scanf("%d", &number) !=EOF){
char ord[150]={0};
scanf("%s", ord);
if(number<=4){
int loc = 1;
for(int i=0; i<number; i++){
printf("%d ", i+1);
}
printf("\n");
for(int i=0; ord[i] != '\0'; i++)
{
if(ord[i] == 'D'){
loc = (loc+1)%number;
if(loc == 0 )loc = number;
}
else{
loc=(loc+number-1)%number;
if(loc==0)loc=number;
}
}
printf("%d\n", loc);
}
else{
int loc = 1;
int top = 1;
for(int i=0; ord[i] != '\0'; i++)
{
if(ord[i] == 'D'){
if(loc == number)top=1;
loc = (loc+1)%number;
if(loc == 0 )loc = number;
if(loc-top>3)top++;
}
else{
if(loc == 1)top = number -3;
loc=(loc+number-1)%number;
if(loc==0)loc=number;
if(loc<top)top=loc;
}
}
printf("%d %d %d %d\n%d\n", top, top+1, top+2, top+3, loc);
}
}
}