#include<stdio.h>
#include<stdlib.h>
typedef dtruct node{
    int data;
    struct node* prev;
    struct node *next;
}nd;
nd *head=NULL,*tail,*temp=NULL,*newnode=NULL;
void create(int val){
    newnode=(nd*)malloc(sizeof(nd));
    newnode->data=val;
    newnode->prev=NULL;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        newnode->prev=tail;
        tail=newnode;
        
    }
}
void display(){
    temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
        
    }
}

int main(){
    int n;
    scanf("%d ",&n);
    if(n<=0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++){
        int x;
        if(scanf("%d \n",&x)!=1){
            printf("Invalid input");
            return 0;
        }
        create(x);
        
    }
    display();
    return 0;
}