#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
    int data;
    struct Node*next;
    struct Node*prev;
}Node;
Node*createNode(int data){
    Node*newNode=(Node*)malloc(sizeof(Node));
    if(!newNode){
        printf("Memory error\n");
        return NULL;
    }
    newNode->data=data;
    newNode->next=newNode->prev=NULL;
    return newNode;
}
void insertEnd(Node**head,int data){
    Node*newNode=createNode(data);
    if(*head==NULL){
        head=newNode;
        return;
    }
    Node*temp=*head;
    while(temp->next){
        temp=temp->next;
    }
    temp->next=newNode;
    newNode->prev=temp;
}
void printList(Node*head){
    while(head){
        printf("%d",head->data);
        head=head->next;
    }
    printf("\n");
}
int main(){
    int n;
    if(scanf("%d",&n)!=1||n<=0){
        printf("Invalid input");
        return 0;
    }
    Node*head=NULL;
    for(int i=0:i<n:i++){
        int x;
        if(scanf("%d",&x)!=1){
            printf("invalid input\n");
            return 0;
        }
        insertEnd(&head,x);
    }
    printList(head);
    return 0;
}