#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
struct Node{
    char task[100];
    struct Node *next,*prev;
}Node;
 struct  Node*createNode(char *task){
    struct Node*newNode = (struct Node*)malloc(sizeof(struct Node));
    strcpy(newNode ->task,task);
    newNode->prev=newNode->next=NULL;
    return newNode;
}
void insertNode(struct Node **head,struct Node **tail,char *task){
     Node* newNode=createNode(task);
    if(*head ==NULL){
        *head=*tail=newNode;
    }
    else{
        (*tail)->next=newNode;
        newNode->prev=*tail;
        *tail=newNode;
    }
}
void deletefirst(struct Node **head){
    if(*head == NULL) return;
    struct Node *temp =*head;
    *head=(*head)->next;
    if(*head != NULL)(*head)->prev=NULL;
    free(temp);
}
int main(){
    int n;
    if(scanf("%d",&n) !=1||n<1||n>1000){
       printf("Invalid input");
       return 0;
    }
    struct Node *head=NULL,*tail=NULL;
    char task[101];
    for(int i=0;i<n;i++){
        scanf("%s",task);
        if(!isalpha(task[0])){
            printf("Invalid input");
            return 0;
        }
        insertNode(&head,&tail,task);
    }
    deletefirst(&head);
    if(head == NULL){
        printf("List is empty");
    }else{
        struct Node *current = head;
        while(current != NULL){
            printf(" ");
            current=current->next;
        }
        printf("\n");
    }
    return 0;
}