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