#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
    int id;
    struct Node*prev,*next;
}Node;
int main(){
    int n,id,i;
    Node *head=NULL,*tail=NULL,*temp;
    if(scanf("%d",&n)!=1 || n<=0){
        printf("Invalid input\n");
        return 0;
    }
    for(i=0;i<n;i++){
        if(scanf("%d",&id)!=1){
            return 0;
        }
        temp=(Node*)malloc(sizeof(Node));
        temp->id=id;
        temp->next=NULL;
        temp->prev=tail;
        if(tail)
        tail->next=temp;
        else
        head=temp;
        
        tail=temp;
    }
    for(temp=head;temp;temp=temp->next){
        printf("%d ",temp->id);
    }
    return 0;
}
    }
}