#include<stdio.h>
#include<stdlib.h>
typedef struct doubly
{
    int data;
    struct doubly *next,*prev;
}node;
node *head=NULL,*tail=NULL;
void create(int num)
{
    node *nd=(node*)malloc(sizeof(node));
    nd->data=num;
    nd->next=NULL;
    nd->prev=NULL;
    if(head==NULL)
    {
        head=nd;
        tail=nd;
    }
    else
    {
        nd->prev=tail;
        tail->next=nd;
        tail=nd;
    }
}
void print()
{
    node *temp=head;
    while(temp!=NULL)
    {
        printf("%d ",temp->data);
        temp=temp->next;
    }
}
int main()
{
    int num,data;
    scanf("%d",&num);
    if(n<=0)
    {
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        if(!scanf("%d",&data))
        {
           printf("Invalid input");
           return 0;
        }
        create(data);
    }
    print();
}