#include<stdio.h>
#include<stdlib.h>

typedef struct Node{
    int data;
    struct Node *next;
}node;

node *head=NULL,*tail;

void create(int num){
    node *newNode = (node*)malloc(sizeof(node));
    newNode->data = num;
    newNode->next = NULL;
    if(head == NULL){
        head = newNode;
    }
    else{
        tail->next = newNode;
    }
    tail = newNode;
}

void deletion(int del){
    node *first = head;
    node *second = head->next;
    // int cnt =1;
    while(1){
        if(second->data == del){
           first->next = second->next;
           break;
        } 
        else{
            printf("Not Found");
            return 0;
        }
        first = first->next;
        second = second->next;
    }
}

void display(){
    node *i;
    for(i=head; i!=NULL;i=i->next){
        printf("%d ",i->data);
    }
}

int main(){
    int n,num,del;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&num);
        create(num);
    }
    scanf("%d",&del);
    
    deletion(del);
    display();
    
}