#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node*prev;
struct node*next;
};
struct node* head=NULL;
void append(int value){
struct node* newnode=(struct node*)malloc(sizeof(struct node));
newnode->data=value;
newnode->prev=NULL;
newnode->next=NULL;
if(head==NULL)
{
head=newnode;
}
else
{
struct node* temp=head;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=newnode;
newnode->prev=temp;
}}
void display()
{
int n,value;
if(scanf("%d",&n)!=1||n<=0)
{
printf("Invalid input");
return 0;
}}
for(int i=0;i<n;i++){
if(scanf("%d",&value)!=1)
{
printf("Inavlid input");
return 0;
}
append (value);
}
display()
return 0;
}