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