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