#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node*next;
};
int main(){
    int n,x;
    scanf("%d",&n);
    if(n<=0){
        printf("List is empty");
        return 0;
    }
    struct node*head=NULL,*temp,*newnode;
    for(int i=0;i<n;i++){
        newnode=(struct node*)malloc(sizeof(struct node));
        scanf("%d",&newnode->data);
        newnode->next=NULL;
        if(head==NULL)
        head=temp=newnode;
        else{
            temp->next=newnode;
            temp=newnode;
        }
    }
    scanf("%d",&x);
    for(node *i=head;i!=NULL;i=i->next){
        if(x!=i->data){
            printf("Not found");
        }
    }
    struct node*curr=head,*prev=NULL;
    while(curr!=NULL &&curr->data!=x){
        prev=curr;
        curr=curr->next;
    }
    if(prev==NULL)
    head=head->next;
    else
    prev->next=curr->next;
    free(curr);
    if(head==NULL){
        printf("List is empty");
        return 0;
    }
    temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
    return 0;
}