#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *next,*prev;
}node;
node *head=NULL,*tail,*first,*second;

voide create(int num){
    node *newnode=(node*)malloc(1*sizeof(node));
    newnode->data=num;
    newnode->next=NULL;
    newnode->prev=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        newnode->prev=tail;
        tail->next=newnode;
        tail=newnode;
    }
}

/*void del(int val){
    first=head;
    second=head->next;
    while(head!=NULL){
        if(){
            
        }
        else{
            first=first->next;
            second=second->next;
        }
    }
}*/

void display(int val){
    node *i;
    for(i=head;i!NULL;i=i->next){
        if(val!=i->data){
            printf("%d ",i->data);
        }
    }
}

int main(){
    int s,n,i;
    scanf("%d",&s);
    for(i=0;i<s;i++){
        scanf("%d",&n);
        create(n);
    }
    int val;
    scanf("%d",&val);
    
    del(val);
    return 0;
}