//ambrisan
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
typedef struct node{
    char task[101];
    struct node* prev;
    struct node* next;
}node;
node* createnode(char* task){
    node* newnode=(node*)malloc(sizeof(node));
    strcpy(newnode->task,task);
    newnode->prev=NULL;
    newnode->next=NULL;
    return newnode;
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<1||n>1000){
        printf("Invalid input");
        return 0;
    }
    node* head=NULL;
    node* tail=NULL;
    for*int i=0;i<n;i++)
    {
        char task[101];
        scanf("%s",task);
        if(isdigiy(task[0])){
            printf("Invalid input");
            return 0;
        }
        node* newnode=createnode(task);
        if(head==NULL){
            head=tail=newnode;
        }
        else{
            tail->next=node;
            newnode->prev=tail;
            tail=newnode;
        }
    }
    if(head1=NULL){
        node* temp=head;
        head=head->next;
        if(head!=NULL)
        head-<prev=NULL;
        free(temp);
        }
        if(head==NULL){
            printf("List is empty,\n");
        }
        else
        {
            node* current=head;
            whil (current!=NULL){
                printf("%s",current->task);
                if(current->next!=NULL){
                    printf("");
                    current=current->next;
                }
                
            }
           
        }
        printf("\n");
        
        
    }
    return 0;
}