// editor1
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>

struct node
{
    
    char task[100];
    struct node *prev,*next;
    };

struct node createnode (int task){
    struct node *newnode = (struct node*)mallco(sizeof(struct node));
    strcpy(newnode->task,task);
    newnode->prev = newnode->next = NULL;
    return newnode;
}

void insertend(struct node **head, struct node **tail,char *task){
    struct node *newnode = createnode(task);
    if (*head == NULL){
        *head = *tail - newnode;
    }
    else{
        (*tail)->next = newnode;
        newnode->prev = *tail;
        *tail = newnode;
    }
}

void deletefrist(struct node **head){
    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;
        }
        insertend(&head,&tail,task);
        
    }
    deletefrist(&head);
    if(head == NULL){
        printf("List of empty\n");
    }
    else{
        struct node *current = head;
        while (current != NULL){
            printf("%s", current->task);
            if(current->next != NULL){
                printf(" ");
                current = current->next;
            }
            printf("\n");
        }
        return 0;
    }
}