// editor1
//editor1
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
typedef struct Node{
    char name[256];
    struct Node*prev,*next;
}Node;
Node*append(Node*tail,const char*s)
{
    Node*n=malloc(sizeof(Node));
    strcpy(n->name,s);
    n->next=NULL;
    n->prev=tail;
    if(tail)tail->next=n;
    return n;
}
void print_and_free_from(Node*head){
    Node*cur=head;
    int first=1;
    while(cur){
        if(!first)printf("");
        printf("%s",cur->name);
        first=0
        Node*tmp=cur;
        cur=cur->next;
        free(tmp;)
    }
    if(!first)printf("\n");
}
int main(){
    char token[256];
    if(scanf("%255s",token)!=1)
    {printf(invalid input\n");return 0;}
    for(size-ti=0;i<strlen(token);++i)
    if(!isdigit(unsigned char)token[i]))
    {printf("invalid input\n");return 0;}
    int n=atoi(token);
    if(n<=0){printf("List is empty\n");
    return 0;}
    Node*head=NULL,*tail=NULL;
    int invalid=0;
    for(int i=0;i<n;i++){
        if(tail==NULL){
            head=tail=append(NULL,token);
        }else{
            tail=append(tail,token);
        }
    }
    if(invalid){
        Node*cur=head;
        while(cur){Node*t=cur;cur=
    cur->next;free(t);} 
    print("invalid input\n");
    return 0;
    }
    if(head==NULL){printf("List is
    empty\n");return0;}
    Node*new-head=head->next;
    free(head);
    if(new-head)new_head->prev=NULL;
    else{
        print("List is empty\n");
        return 0
    }
    print-and-free-from(new-head);
    return 0;
    }
    }
    }
    }