#include<stdio.h>
#include<stdlib.h>
struct Node{
    int data;
    struct Node *next;
};
struct Node* insertEnd(struct Node* head,int data){
    struct Node* newNode =(struct Node*)malloc(sizeof(struct Node));
    newNode->data =data;
    newNode->next =NUll;
    if(head == NULL)
    return newNode;
    struct Node* temp =head;
    while(temp->next !=NULL)
    temp=temp ->next;
    temp->next =newNode;
    return head;
}
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;
    if(scanf("%d",&n)!=1){
        printf("Invalid Input");
        return 0;
    }
    if(n<0){
        printf("Invalid Input");
        return 0;
    }
    struct Node* head =NULL;
    for(int i =0;i<n;i++){
        int val;
        if(scanf("%d",&val)!=1){
            printf("Invalid Input");
            return 0;
        }
        if(val<-1000 ||val>1000){
            printf("Invalid Input");
            return 0;
        }
        head =insertEnd(head,val);
}
printList(head);
return 0;
}