#include <stdio.h>
#include <stdlib.h>

struct Node {
    int data;
    struct Node* prev;
    struct Node* next;
};


struct Node* createNode(int value) {
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data = value;
    newNode->prev = NULL;
    newNode->next = NULL;
    return newNode;
}


void insertEnd(struct Node** head, int value) {
    struct Node* newNode = createNode(value);
    if (*head == NULL) {
        *head = newNode;
        return;
    }
    struct Node* temp = *head;
    while (temp->next != NULL) {
        temp = temp->next;
    }
    temp->next = newNode;
    newNode->prev = temp;
}
void printList(struct Node* head){
    struct Node* temp=head;
    while(temp!=NULL){
        printf(" ");
    }
    temp=temp->next;
    }
}
int main()
int n,value;
if(scanf("%d",&n)!=1||n<=0){
    printf("Invalid input");
    return 0;
    
}
struct Node* head=NULL;
for(int i=0;i<n;i++){
    if(scanf("%d",&value)!=1){
        printf("Invalid input");
        return 0;
    }
    insertEnd(&head,value);
}
printList(head);
return 0;
}