#include<stdio.h>
#include<stdlib.h>
struct Node{
    int data;
    struct Node*prev;
    struct Node*next;
};
struct Node* createNode(int data){
    struct Node*newNode=(struct Node*)malloac(sizeof(struct Node));
    newNode->data=data;
    newNode->prev=NULL;
    newNode->nnext=NULL;
    return newNode;
}
struct Node*insertEnd(struct Node*head,int data){
    struct Node*newNode=createNode(data);
    if(head==NULL)
    return newNode;;
    struct Node*temp=head;
    while(temp->next!=NULL)
    temp=temp->next;
    temp->next=newNode;
    newNode->prev=temp;
    return head;
}

void display(struct Node*head){
    struct Node*temp=head;
    while(temp!=NULL){
        printf("%d",temp->data);
        if(temp->next!=NULL)
           printf(" ");
           temp=temp->next;
    }
}

int main(){
    int n;
    if(scanf("%d",&n)!=1){
        printf("Invalid input");
        return 0;
    }
    if(n<=0){
        printf("Invalid input");
        return 0;
    }
    struct Node*head=NULL;
    for(int i=0;i<n;i++){
        int value;
        if(scanf("%d",&value)!=1)
        {
            printf("Invalid input");
            return 0;
        }
        head=insertEnd(head,value);
    }
    display(head);
    return 0;
}