#include<stdio.h>
#include<stdlib.h>

struct Node{
    int data;
    struct Node*next;
};
struct Node*createNode(int data){
    struct Node* newNode= malloc(sizeof(struct Node));
    if(newNode==NULL){
        return NULL;
    }
    newNode->data=data;
    newNode->next=NULL;
    return newNode;
}
void insertEnd(struct Node**head,int data){
    struct Node* newNode=createNode(data);
    if(newNode==NULL){
        return;
    }
    if(*head==NULL){
        *head=newNode;
        return;
    }
    struct Node*currentNode=*head;
    while(currentNode->next!=NULL){
        currentNode=currentNode->next;
    }
    currentNode->next=newNode;
}
void display(struct Node*head){
    struct Node*currentNode=head;
    while(currentNode!=NULL){
        printf("%d",currentNode->data);
        if(currentNode->next !=NULL)
        printf(" ");
        currentNode=currentNode->next;
    }
    printf("\n");
}
void freeList(struct Node*head){
    struct Node*currentNode=head;
    while(currentNode!=NULL){
        struct Node*nextNode=currentNode->next;
        free(currentNode);
        currentNode=nextNode;
    }
}
int main(void){
    int n;
    struct Node*head=NULL;
    if(scanf("%d",&n)!=1||n<0||n>10){
        printf("Invalid input\n");
        return 0;
    }
    for(int i=0;i<n;i++){
        int value;
        if(scanf("%d",&value)!=1){
            printf("Invalid input\n");
            freeList(head);
            return 0;
            
        }
        if(value<-1000||value>1000){
            printf("Invalid input\n");
            freeList(head);
        }
        insertEnd(&head,value);
    }
    display(head);
    freeList(head);
    return 0;
}