#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

typedef struct Node {
    int data;
    struct Node *next;
} Node;

Node* createNode(int value) {
    Node* newNode = (Node*)malloc(sizeof(Node));
    newNode->data = value;
    newNode->next = NULL;
    return newNode;
}

int isNumber(char *str) {
    int i = 0;
    if (str[0] == '-') 
        i = 1;

    if (str[i] == '\0')
        return 1;

    for(; i < strlen(str); i++) {
        if (!isdigit(str[i]))
            return 0;
    }
    return 1;
}

int main() {
    int n;
    scanf("%d", &n);

    if (n < 1 || n > 100) {
        printf("Invalid input");
        return 1;
    }

    Node *head = NULL;
    for (int i = 0; i < n; i++) {
        char input[50];
        scanf("%s", input);

        if (!isNumber(input)) {
            printf("Invalid input");
            return 1;
        }

        int value = atoi(input);
        Node* newNode = createNode(value);

        newNode->next = head;
        head = newNode;
    }

    Node *temp = head;
    while (temp != NULL) {
        printf("%d ", temp-data);
        temp = temp->next;
    }

    return 1;
}