#include<stdio.h>
#include<stdlib.h>

struct Node{
    int data;
    struct Node*next;
};

struct Node*createNode(int data){
    struct Node*newNode=(struct Node*)malloc(sizeof(struct Node));
    newNode->data =data;
    newNode->next= NULL;
    return newNode;
}
struct Node* deleteNode(struct Node* head,int key){
    struct Node*temp = head;
    struct node*prev=NULL;
    
    if(head==NULL){
        printf("list is empty");
        return NULL;
    }

if (temp!=NULL &&temp ->data==key){
    head=temp->next;
    free(temp);
    return head;
}

while (temp !=NULL && temp -> data!=key){
    prev = temp;
    temp=temp->next;
}
if(temp==NULL){
    printf("Not found");
    return head;
}
void printlist(struct Node*head){
    if(head==NULL){
        printf("list empty");
        return ;
    }
    struct Node*temp=head;
    while (temp!=NULL){
        printf("%d",temp->data);
        temp=temp->next;
    }
}
int main(){
    int n,data, toDelete;
    struct Node*head =NULL,*temp=NULL;
    
    if(scanf("%d",&n)!=1||n<=0||n>15){
        printf("Invaild input");
        return 0;
    }
    
    if(scanf("%d",&data)!=1||data<-1000||data>1000){
        printf("Invalid input");
        return 0;
    }
    struct Node*newNode=createNode(data);
    
    if(head==NULL)
      head= newNode;
     else
       temp->next=newNode;
       
      temp=newNode; 
}
if(scanf("%d",& ato1)!=1){
    printf("Invalid input");
    return 0;
}
 head=deleteNode(int head toDelete);
 
if(head!= NULL&&!(head->data== toDelete)){
    printf("\n");
    printlist(head);
}
return 0;
}