#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node *next;
};
int main(){
    int n,x,i;
    struct node *h=NULL,*t,*p,*c;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        c=malloc(sizeof(struct node));
        scanf("%d",&c->data);
        c->next=NULL;
        if(!h)h=t=c;
        else t->next=c,t=c;
    }
    scanf("%d",&x);
    c=h; p=NULL;
    while(c && c->data !=x) p=c,c=c->next;
    if(!c){
        printf("Node not found");return 0;}
        if(!p) h=c->next;
        else p->next=c->next;
        for(c=h;c=c->next)
        printf("%d",c->data);
        return 0;
}