// editor4
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node*next;
}node;
node*head=NULL,*tail;

void insertnode(int r){
    node*newnode=(node*)malloc(sizeof(node));
    newnode->data=r;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        tail=newnode;
    }
}

void deletenode(int m,int *count){
    node*temp=head;
    if(head==NULL){
        printf("List is empty");
    }
    else{
        while(temp!=NULL){
            if(temp->data==m){
                temp->data=temp->next->data;
                temp->next=temp->next->next;
                *count=0;
            }
            temp=temp->next;
        }
    }
}

void display(){
    node*temp=head;
    while(temp!NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
}

int main(){
    int n,m,r;
    int count=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&r);
        insertnode(r);
    }
    scanf("%d",&m);
    deletenode(m,&count);
    if(count){
        printf("Not Found");
        return 0;
    }
    display();
}