#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node *next,*prev;
}Node;
Node *head=*tail,NULL;
void create(int num){
    Node *newNode=(Node*)malloc(sizeof(Node));
    newNode->data=num;
    newNode->next=NULL;
    newNode->prev=NULL;
    if(head!=NULL){
        head=newNode;
        tail=newNode;
    }
    else{
        newNode->prev=tail;
        tail->next=newNode;
        tail=newNode;
    }
}
void display(){
    Node *itr;
    for(itr=0;itr!=NULL;itr=itr->next)
    printf("%d",itr->data);
}
int main(){
    int n,num,itr;
    scanf("%d",&n);
    for(itr=0;itr<n;itr++){
        scanf("%d",&num);
        if(num<0){
            printf("Node not found");
            return 0;
        }
        create(num);
    }
    return 0;
}