#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

// Check if string is a valid integer
int is_integer(char *str) {
    int i = 0;
    // Handle negative numbers
    if (str == '-') i++;
    // Must have at least one digit after optional '-'
    if (str[i] == '\0') return 0;
    // Check all remaining characters are digits
    while (str[i]) {
        if (!isdigit(str[i])) return 0;
        i++;
    }
    return 1;
}

int main() {
    char buffer;
    int n;
    
    // Read n (number of emergency shipments)
    if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
        printf("Invalid input");
        return 0;
    }
    // Remove newline character
    buffer[strcspn(buffer, "\n")] = '\0';
    
    // Validate n is integer
    if (!is_integer(buffer)) {
        printf("Invalid input");
        return 0;
    }
    n = atoi(buffer);
    
    // Array to store emergency quantities
    int shipments;
    
    // Read n emergency quantities
    for (int i = 0; i < n; i++) {
        if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
            printf("Invalid input");
            return 0;
        }
        buffer[strcspn(buffer, "\n")] = '\0';
        
        // Validate each quantity is integer
        if (!is_integer(buffer)) {
            printf("Invalid input");
            return 0;
        }
        shipments[i] = atoi(buffer);
    }
    
    // Print quantities in reverse order
    for (int i = n - 1; i >= 0; i--) {
        printf("%d", shipments[i]);
        if (i > 0) {
            printf(" ");
        }
    }
    
    return 0;
}