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