// editor3
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node*next;
}node;
node*head=NULL,*tail;
int 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;
    }
}
node*first,*second;
void deletev(int val){
 
    first=head;
    second=head->next;
    if(first->data==val){
        head=head->next;
    }else{
        while(second != NULL){
            if(second->data==val){
                first->next=second->next;
                break;
            }
            first=first->next;
            second=second->next;
        }
    }
}
void display(){
    node*itr=head;
    for(;itr!=NULL;itr->next){
        printf("%d",itr->data);
    }
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    for(int i<0;i<n;i++){
         scanf("%d",&n);
         create(num);
    }
    int val;
    scanf("%d",&val);
    deletev(val);
    display();
    
}