#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *next;
    struct node *prev;
}Node;

void create(int num){
    Node *newNode=(Node*)malloc(1 * sizeof(Node))
    newNode->prev=NULL;
    newNode->data=num;
    newnode->next=NULL;
    if(head == 0){
        head = newNode;
        tail = newNode;
    }
    else{
        newNode->prev=tail;
        tail->next=newNode;
        tail=newNode;
    }
}

void display(){
    Node *itr;
    for(itr=head;itr!=NULL;itr=itr->next){
        printf("%d",itr->data);
    }
}


int main(){
    int N,itr,num,val;
    scanf("%d",&N);
    
    for(itr=0;itr<N;itr++){
        scanf("%d",&num);
        create(num);
    }
    scanf("%d",&val);
    deletion(val);
    display();
    
}