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