#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node *next;
}s2;
s2 *head=NULL,*tail=NULL;
s2 *first=NULL,*second=NULL;
void create(int num){
    s2 *New=(s2*)malloc(1*sizeof(s2));
    New->data=num;
    New->next=NULL;
    if(head==NULL){
        head=New;
        tail=New;
    }else{
        tail->next=New;
        tail=New;
    }
}
void delete(int ele){
    first=head;
    second=head->next;
    if(ele == head->data){
        head=head->next;
    }else{
        while(second !=NULL){
            if(second>data == ele){
                first->next=second->next;
                break;
            }
            first=first->next;
            second=second->next;
        }     
    }
}
    

void display(){
    s2 *i;
    for(i=head;i!=NULL;i=i->next){
        printf("%d ",i->data);
    }
}
int main(){
    int size,num,ele;
    scanf("%d",&size);
    for(int itr=1;itr<=size;itr++){
        scanf("%d ",&num);
        create(num);
    }
    
    scanf("%d",&ele);
    delete(ele);
    if(second == NULL){
        printf("List is empty");
    }else{
        display(); 
    }
    
}