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