#include <stdio.h>
#include <stdlib.h>

struct Node {
    int data;
    struct Node* prev;
    struct Node* next;
};

struct Node* head = NULL;
struct Node* tail = NULL;

// Function to insert a node at the end
void insertEnd(int value) {
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data = value;
    newNode->prev = NULL;
    newNode->next = NULL;

    if (head == NULL) {
        head = tail = newNode;
    } else {
        tail->next = newNode;
        newNode->prev = tail;
        tail = newNode;
    }
}

// Function to display list
void displayList() {
    struct Node* temp = head;
    while (temp != NULL) {
        printf("%d ", temp->data);
        temp = temp->next;
    }
}

int main() {
    int n, value;
    scanf("%d", &n);

    if (n <= 0 || n > 10) {
        printf("Invalid Input");
        return 0;
    }

    for (int i = 0; i < n; i++) {
        if (scanf("%d", &value) != 1) {  // invalid integer check
            printf("Invalid Input");
            return 0;
        }
        insertEnd(value);
    }

    displayList();
    return 0;