#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
struct Node{
    int data;
    struct Node*next;
};
struct Node* creatNode(int data){
    struct Node* newnode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data=data;
    newNode->next=NULL;
    return newNode;
}
void printList(struct Node*head){
    struct Node* temp=head;
    while(temp != NULL){
        printf("%d",temp->data);
        if(temp->next != NULL)
        printf(" ");
        temp = temp->next;
    }
}
int main(){
    int n,value;
    struct Node *head=NULL, *temp = NULL,*newNode = NULL;
    scanf("%d",&n);
    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<0 || value< -1000 || value>1000){
            printf("Invalid input");
            return 0;
        }
        newNode = creatNode(value);
        if(head == NULL)
        head = newNode;
        else
        temp->next=newNode;
        temp = newNode;
    }
    printList(head);
    return 0;
}