#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node* next;
    struct node* prev;
};
struct node* createnode(int data){
    struct node* newnode = (struct node*)malloc(sizeof(struct node));
    newnode->data=data;
    newnode->prev=NULL;
    newnode->next=NULL;
    return newNode;}
void append (struct node **head,struct node** tail,int data){
    struct node* newnode= createnode(data);
    if(*head == NUll){
        *head = newnode;
        *tail = newNode;
    }
    else{
        (*tail)->next=newnode;
        newnode->prev= *tail;
        *tail = newNode;
    }
}
void printList(struct node* head){
    struct node* current = head;
    while (current !=NULL){
        printf("%d",current->data);
        if(current->next != NULL){
            printf(" ");
        }
        current = current->next;
    }
    printf("\n");
}

int main(){
    int n;
    scanf("%d",&n);
    struct node* head= NULL;
    struct node* tail = NULL;
    for (int i=0;i<n;i++){
        int id;
        scanf("%d",&id);
        append(&head,&tail,id);
    }
    printList(head);
    return 0;
}