// editor1
#include<stdio.h>
#include<stdlib.h>
struct Node{
   int data;
   struct Node*prev;
   struct Node*next;
};
struct Node*createNode(int data){
    struct Node*newNode=(struct Node*)malloc(sizeof(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=*tail=newNode;
    }
    else{
        (*tail)->next=newNode;
        newNode->prev=*tail;
        *tail=newNode;
    }
 }
 void display(struct Node*head){
  struct Node*temp=head;
  while(temp!=NULL){
      printf("%d",temp->data);
      if(temp->next!=NULL){
          printf(" ");
      }
      temp=temp->next;
  }
  printf("\n");
}
int main(){
    int n,value;
    if(scanf("%d",&n)!=1 || n<=0)
    {
        printf("Invalid input\n");
        return 0;
    }
    struct Node*head=NULL;
    struct Node*tail=NULL;
    for(int i=0;i<n;i++)
    {
        if(scanf("%d",&value)!=1){
            printf("Invalid input"\n);
            return 0;
        }
        append(&head,&tail,value);
    }
    display(head);
    return 0;
}