#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *next;
    
}Node;

Node *head=NULL,*tail,*prev;
void create(int num){
    Node *newNode=(Node*)malloc(sizeof(Node));
    newNode->data=num;
    newNode->next=NULL;
    
    if(head==NULL){
        head= newNode;
        tail= newNode;
    }
    else{
        tail->next= newNode;
        tail= newNode;
    }
}

void display(){
    Node *temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
}

void delete_at_pos(int element){
    Node *temp ,*prev;
    temp=head;
     
     if(head->data==element){
         head=head->next;
         free(temp);
         return;
     }
     }
     while(temp!=NULL && temp->data!=element){
         prev=temp;
         temp=temp->next;
     }
       if(temp == NULL){
           printf("Not Found");
           return;
       }
        prev->next=temp->next;
        
        if(temp==tail){
            prev=tail;
        }
        
        
         free(temp);
}



int main(){
    int n,val,e;
    scanf("%d",&n);
    if(n<0 || n > 10){
        printf("Invalid input");
        return 0;
    }
    for(int i=0 ; i<n ;i++){
        scanf("%d",&val);{
            if(val < 0 || val >100){
                printf("Invalid input");
            }
        }
        create(val);
    }
    scanf("%d",&e);
    delete_at_pos(e);
    display();
    
    return 0;
}