#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
    int data;
    struct Node*next;
    struct Node*prev;
}node;

node*head=NULL,*tail;

void create(int num){
    node *newnode=(node*)malloc(1*sizeof(node));
    newnode->data=num;
    newnode->next=NULL;
    newnode->prev=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        newnode->prev=tail;
        tail=newnode;
    }
}

node*first,*second;

int del(int val){
    if(head==NULL)return 0;
    int found=0;
    first=head;
    second=head->next;
    if(first->data==val){
        found=1;
        head=head->next;
        head->prev=NULL;
        free(first);
        return 1;
    }
    else{
        while(second!=NULL){
            if(second->data==val){
                found=1;
                first->next=second->next;
                if(second->next!=NULL){
                    prinf("%d ",itr->data);
                }
            }
            int main(){
                int size,num;
                scanf("%d",&size);
                for(int i=1;i<=size;i++){
                    scanf("%d",&num);
                    create(num);
                }
                int val;
                scanf("%d",&val);
                int result=del(val);
                if(result==0){
                    printf("Node not found");
                }
                else
                display();
                return 0;
            }