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

struct Node {
    int data;
    struct Node* next;
};
 int main() {
     int n;
     scanf("%d", &n);
     
     if(n<0) {
         printf("Invalid input");
         return 0;
     }
     struct Node *head = NULL, *temp = NULL, *newNode;
     
     for (int i = 0; i < n, i++) {
         int val;
         if (scanf("%d", &val) !=1 || val < -1000 || val >1000) {
             printf("Invalid input");
             return 0;
         }
         newNode = (struct Node*)malloc(sizeof(struct Node));
         newNode->data = val;
         newNode->next = NULL;
         
         if (head == NULL) {
             head = newNode;
             temp = newNode;
         } else {
             temp->next = newNode;
             temp = mewNode;
         }
     }
     
     temp = head;
     while (temp != NULL) {
         printf("%d ", temp->data);
         temp = temp->next;
     }
     return o;
 }