#include<stdio.h>
#include<stdlib.h>


typedef struct node{
   int data;
   struct node *next;
}Node;
  Node *head=NULL,*tail=NULL,*temp;
  
int create(int val){
    Node *new= (Node*)malloc(sizeof(Node));
    new->data=val;
    new->next=NULL;
    
    if(head==NULL){
        head=tail=new;
    }
    else{
        tail->next=new;
        tail=new;
    }
}



void deletion(int ele){
    
    if(head->data==ele){
        head=head->next;
        return ;
    }
    else{
        Node *temp=head,*prev;
       while(temp->data!=ele){
            prev=temp;
            temp=temp->next;
        }
        prev->next=temp->next;
    }
}
void display(){
    temp=head;
    while(temp != NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
}
int main(){
     int n,ele,num;
     scanf("%d",&n);
    
     for(int i=0 ;i < n; i++){
         scanf("%d",&num);
         create(num);
     }
     scanf("%d",&ele);
    
     deletion(ele);
     
    if(!(deletion(ele))){
        printf("Element not found")
    }
     display();
     
    return 0;
}