#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
struct Node{
    int data;
    struct Node *next;
};
struct Node* createNode(int data){
    struct Node *newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data = data;
    newNode->next = Null;
    return 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;
    if(scanf("%d", &n) != 1 || n<0){
        printf("Invalid input");
        return 0;
    }
    if(n==0){
        printf("Invalid input");
        return 0;
    }
    if(n > 10){
        printf("Invalid input");
        return 0;
    }
    struct Node *head = NULL,*tail = NULL;
    for(int i=0;i<n;i++){
        int value;
        if(scanf("%d", &value)!=1){
            printf("Invalid input");
            return 0;
        }
        if(value< -1000 || value > 1000){
            printf("Invalid input");
            return 0;
        }
        struct Node *newNode = createNode(value);
        if(head == NULL)
        head = tail = newNode;
        else{
            tail->next = newnode;
            tail = newNode;
        }
    }
    display(head);
    return 0;
}