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