/*Delete Function works*/
#include<stdio.h>
#include<stdlib.h>
struct n
{
int x,y;
struct n *next;
};
typedef struct n node;
node *head;
node *start;
void takeIn(int n)
{
head = (node *)malloc(sizeof(node));
start = head;
int i;
for(i=0; i<n; i++)
{
scanf("%d %d",&head->x,&head->y);
head->next = (node*)malloc(sizeof(node));
head = head->next;
}
head->next = NULL;
}
void d(int itm)
{
node *st = start;
node *prev = NULL;
node *cur;
node *ex;
while(st->next)
{
if(st->next->x == itm)
{
prev = st;
}
st = st->next;
}
if(prev != NULL)
{
cur = prev->next->next;
free(prev->next);
prev->next = cur;
}
}
void p()
{
node *st = start;
while(st->next)
{
printf("%d %d\n",st->x,st->y);
st= st->next;
}
}
int main()
{
int s,m,n;
scanf("%d",&s);
takeIn(s);
while(1)
{
printf("Delete: ");
scanf("%d %d",&m,&n);
d(m);
p();
}
return 0;
}