#include<stdio.h>
#include<stdlib.h>
struct N{int d;struct N*next;};
int main(){
    int n,x,k;scanf("%d",&n);
    struct N*head=NULL,*t,*p;
    for(int i=0;i<n;i++){
        scanf("%d",&n);
        t=malloc(size of(struct N));
        t->d=x;t->next=NULL;
        if(head) head=t;
else{p=head,
        while(p->next)p=p->next;p->n ext=t;}
    }
    scanf("%d",&k);
    p=head;struct N*prev=NULL;
    while(p && p->d!=k)
{prev=p;p=p->next;}
    if(!p){printf("Node not Found");
    return 0;}
    if(!prev) head=head->next;else
prev->next=p->next;
    for(p=head;p;p=p->next) printf("%d ",p->d);
}