#include<stdio.h>
#include<stdlib.h>

typedef struct Node {
    int data;
    struct Node *prev;
    struct Node *next;
}node;

node *head = NULL, *tail;

void create(int num){
    node *newNode = (node*) malloc (1 * 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 del(){
    tail = tail->prev;
    tail->next = NULL;
}

void display(){
    node *itr;
    for(itr = head; itr != NULL; itr = itr->next){
        printf("%d ",itr->data);
    }
}
int main(){
    int n,itr,num;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
    }
    for(itr=0; itr<n; itr++){
        scanf("%d", &num);
        create(num)
    }
    display();
}