#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

struct Node {
    char task[101];
    struct Node *prev;
    struct Node *next;
};

int main() {
    int n;
    scanf("%d", &n);
    if (n < 1 || n > 1000) {
        printf("Invalid input");
        return 0;
    }

    struct Node *head = NULL, *tail = NULL;

    for (int i = 0; i < n; i++) {
        char task[101];
        scanf("%s", task);

        // Validate: task name must start with an alphabet
        if (!isalpha(task[0])) {
            printf("Invalid input");
            return 0;
        }

        struct Node newNode = (struct Node)malloc(sizeof(struct Node));
        strcpy(newNode->task, task);
        newNode->prev = tail;
        newNode->next = NULL;

        if (tail) {
            tail->next = newNode;
        } else {
            head = newNode;
        }
        tail = newNode;
    }

    // Remove first task
    if (head) {
        struct Node *temp = head;
        head = head->next;
        if (head) head->prev = NULL;
        free(temp);
    }

    // Print remaining tasks
    if (!head) {
        printf("List is empty");
    } else {
        struct Node *curr = head;
        while (curr) {
            printf("%s", curr->task);
            if (curr->next) printf(" ");
            curr = curr->next;
        }
    }

    return 0;
}