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