// editor4
#include<stdio.h>
#include<stdlib.h>

typedef struct list
{
    int data;
    struct list *next;
}node;

node*head=NULL,*tail;
void create(int n)
{
    node *newnode=(node*)malloc(sizeof(node));
    newnode->data=n;
    newnode->next=NULL;
    
    if(head==NULL)
    {
        head=newnode;
        tail=newnode;
    }
    else
    {
        tail->next=newnode;
        tail=newnode;
    }
}

void print()
{
    for(int i=0;head!=NULL;i++)
    {
        node *temp=head;
        printf("%d ",temp->data);
        temp=temp->next;
    }
}

void del(int n)
{
    node *temp=(node*)malloc(sizeof(node));
    node *temp2=(node*)malloc(sizeof(node));
    temp=head;
    temp2=NULL;
    for(int i=0;i<n;i++)
    {
        temp2=temp;
        temp=temp->next;
    }
    temp2->next=temp->next;
    free(temp);
    print();
}


int main()
{
    int n,data,dele,count=0;
    scanf("%d",&n);
    if(n<=0)
    {
        print("Invalid input");
        return 0;
    }
    int arr[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&data);
        create(data);
        arr[i]=data;
    }
    
    scanf("%d",&dele);
    for(int i=0;i<n;i++)
    {
        if(arr[i]==dele)
        {
            count+=1;
        }
    }
    if(count==0)
    {
        printf("Not Found");
    }
    else
    {
    for(int i=0;i<n;i++)
    {
        if(arr[i]==dele)
            del(i);
    }
    }
    
}