#include <stdio.h>
#include <stdlib.h>

typedef struct node{
    struct node *prev;
    int data;
    struct node *next;
}Node;

Node *head=NULL,*tail;

void create(int num){
    Node *newnode= (Node*)malloc(1 * sizeof(Node));
    newnode->data=num;
    newnode->prev=NULL;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        newnode->prev=tail;
        tail->next=newnode;
        tail=newnode;
    }
}


int main(){
    int N,ind,num;
    scanf("%d",N);
    for(ind=0;ind<N;ind++){
        scanf("%d",&num);
        create(num);
    }
}