#include
#include struct node { int data; struct node *next;
}; struct queue { struct node *head,*tail;
}; void push(queue *q,int data)
{ node *p=new node; p->data = data; p->next = NULL; q->tail->next=p; q->tail=p;
} int pop(queue *q) { if(q->head->next==NULL) return -1; node *p; p=q->head->next; q->head->next=p->next; if(q->head->next==NULL)q->tail=q->head; int tmp=p->data;
delete p; return tmp;
} #define N 100
int a[N][N]; int main(int argc, char *argv[])
{