import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n;

        try {
            n = Integer.parseInt(sc.nextLine());
        } catch (Exception e) {
            System.out.println("Invalid input");
            sc.close();
            return;
        }

        int[] shipments = new int[n];

        boolean invalid = false;

        for (int i = 0; i < n; i++) {
            String line = sc.nextLine().trim();
            try {
                int newEntry = Integer.parseInt(line);

                // Insert at the start of array by shifting existing elements
                for (int j = i; j > 0; j--) {
                    shipments[j] = shipments[j - 1];
                }
                shipments[0] = newEntry; // as instructed
            } catch (Exception e) {
                invalid = true;
            }
        }

        if (invalid) {
            System.out.println("Invalid input");
        } else {
            for (int i = 0; i < n; i++) {
                System.out.print(shipments[i] + " ");
            }
        }

        sc.close();
    }
}