#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;
 }
 int main(){
     int n
     if (scanf("%d",&n)!= 1 || n<0 || n > 10){
         printf("Invalid input");
         return 0;
     }     
     struct node*head=NULL;
     struct node*temp=NULL;
     for(int i=0;i<n;i++){
         int val;
         if(scanf("%d",&val)!=1 || val<-1000 || val>1000){
             printf("Invalid input");
             return 0;
         }
         struct node*newnode=createnode(val);
         if(head==NULL){
             head=newnode;
             temp=head;
         }else{
             temp->next=newnode;
             temp=temp->next;
         }
     }
     temp=head;
     printf("%d",temp->data);
     if(temp->next!=NULL)
     {printf(" ");
     temp=temp->next;
 }
 return 0;
 }
 
 }