#include<stdio.h>
#include<stdlib.h>
void display();
typedef struct Node{
    int data;
    struct Node *prev;
    struct Node *next;
    
}node;

node *head=NULL;
node *tail;
node *newnode;

void create(int num){
    newnode=(node*)malloc(sizeof(node));
    newnode->data=num;
    newnode->prev=NULL;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        newnode->prev=tail;
        tail->next=newnode;
        tail-=newnode;
    }
}

void display(){
    node *itr;
    for(itr=head;itr!=NULL;itr=itr->next){
        printf("%d ",itr->data);
    }
}

int main(){
    int size;
    int num,ind;
    if(!scanf("%d",&size)){
        printf("Invalid input");
        return 0;
    }
    for(ind=0;ind<size;ind++){
        scanf("%d\n",&num);
        create(num);
    }
    display();
    return 0;
}