#include <stdio.h>
#include <stdlib.h>

// Define the structure for a node in the linked list
struct Node {
    int data;
    struct Node* next;
};

// Function to insert a new node at the beginning of the linked list
struct Node* insertAtBeginning(struct Node* head, int value) {
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    if (newNode == NULL) {
        printf("Memory allocation failed!\n");
        exit(1);
    }
    newNode->data = value;
    newNode->next = head;
    return newNode;
}

// Function to print the linked list
void printList(struct Node* node) {
    while (node != NULL) {
        printf("%d ", node->data);
        node = node->next;
    }
    printf("\n");
}

int main() {
    struct Node* head = NULL; // Initialize head of the linked list
    int n, quantity;

    // Read the number of emergency shipments
    if (scanf("%d", &n) != 1 || n < 1 || n > 1000) {
        printf("Invalid input.\n");
        return 1;
    }

    // Read quantities and insert them at the beginning of the linked list
    for (int i = 0; i < n; i++) {
        if (scanf("%d", &quantity) != 1) {
            printf("Invalid input.\n");
            // Free allocated memory before exiting on invalid input
            struct Node* current = head;
            while (current != NULL) {
                struct Node* temp = current;
                current = current->next;
                free(temp);
            }
            return 1;
        }
        head = insertAtBeginning(head, quantity);
        // Note: The problem statement says "shipments[0] = newEntry;" which is array-like
        // but for a linked list, inserting at the head achieves the desired behavior.
    }

    // Print the emergency quantities in reverse of input order
    printList(head);

    // Free the allocated memory for the linked list
    struct Node* current = head;
    while (current != NULL) {
        struct Node* temp = current;
        current = current->next;
        free(temp);
    }

    return 0;
}