#include<stdio.h>
#include<stdlib.h>
struct Node {
    int data;
    struct Node* next;
};
int main() {
    int n, value;
    scanf("%d", &n);
    if (n < 0) {
        printf("Invalid input\n");
        return 0;
    }
    struct Node *head = NULL, *temp = NULL, *newnode = NULL;
    for ( int i = 0; i < n; i++) {
        if (scanf("%d", &value) != 1) {
            printf("Invalid input\n");
            return 0;
        }
        if (value < -1000 || value > 1000)
{
            printf("Invalid input\n");
            return 0;
}
          newNode = (structNode*)malloc(sizeof(struct Node));
          newNode->data = value;
          newNode->next = NULL;
          if (head == NULL)
              head = newNode;
          else
              temp->next = newNode;
          temp = newNode;
    
    }
    temp = head;
    while (temp != NULL) {
        printf("%d", temp->data);
        if (temp->next != NULL)
           printf(" ");
        temp = temp->next;
    }
    return 0;
}