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