#include <stdio.h>
#include <string.h>

int main() {
    int n;
    char s[101];
    while (scanf("%d\n%s", &n, s) != EOF) {
        int steps = strlen(s);
        int menu = 0;
        int current = 0;
        int position = 0;
        for (int i = 0; i < steps; i++) {
            switch (s[i]) {
                case 'U':
                    if (n <= 4) {
                        if (current == 0) {
                            current = n - 1;
                            position = n - 1;
                        } else {
                            current--;
                            position--;
                        }
                        break;
                    } else {
                        if (position == 0) {
                            if (current == 0) {
                                menu = n - 4;
                                current = n - 1;
                                position = 3;
                            } else {
                                menu--;
                                current--;
                            }
                        } else if (current != 0) {
                            current--;
                            position--;
                        }
                        break;
                    }
                case 'D':
                    if (n <= 4) {
                        if (current == n - 1) {
                            current = 0;
                            position = 0;
                        } else {
                            current++;
                            position++;
                        }
                        break;
                    } else {
                        if (position == 3) {
                            if (current == n - 1) {
                                position = 0;
                                current = 0;
                                menu = 0;
                            } else {
                                current++;
                                menu++;
                            }
                        } else if (current == menu + 3) {
                            menu++;
                            current = menu;
                            position = 0;
                        } else {
                            position++;
                            current++;
                        }
                        break;
                    }
            }
        }
        if (n <= 4) {
            for (int i = 0; i < n; i++) {
                if (i == n - 1) {
                    printf("%d\n", i + 1);
                } else {
                    printf("%d ", i + 1);
                }
            }
            printf("%d\n", current + 1);
        } else {
            printf("%d %d %d %d\n", menu + 1, menu + 2, menu + 3, menu + 4);
            printf("%d\n", current + 1);
        }
    }
    return 0;
}