#include <iostream>
#include <algorithm>
#define InitSize 5using namespace std;
typedef struct LNode{int data;struct LNode *next;
}LNode,*LinkList;void List_Output(LinkList L){LNode *s;s=L->next;while(s!=NULL){printf("%d ",s->data);s=s->next;}printf("\n");
}LinkList List_HeadInsert(LinkList &L){LNode *s;int x;L=(LNode *)malloc(sizeof(LNode));L->next=NULL;scanf("%d",&x);while(x!=999){s=(LNode *)malloc(sizeof(LNode));s->data=x;s->next=L->next;L->next=s;scanf("%d",&x);}return L;
}LinkList List_TailInsert(LinkList &L){LNode *s,*r;int x;L=(LNode *)malloc(sizeof(LNode));L->next=NULL;r=L;scanf("%d",&x);while(x!=999){s=(LNode *)malloc(sizeof(LNode));s->data=x;r->next=s;r=s;scanf("%d",&x);}r->next=NULL;return L;
}LNode *GetElem(LinkList L,int i){LNode *p=L->next;int j=1;if(i==0)return NULL;while(p&&j<i){p=p->next;j++;}return p;
}LNode *GetElem2(LinkList L,int e){LNode *p=L->next;while(p!=NULL&&p->data!=e)p=p->next;return p;
}LinkList List_Insert(LinkList &L,LNode *s,int i){LNode *p;p=GetElem(L,i-1);s->next=p->next;p->next=s;return L;
}LinkList List_Insert2(LinkList &L,LNode *s,LNode *p){s->next=p->next;p->next=s;int temp;temp=p->data;p->data=s->data;s->data=temp;return L;
}LinkList List_Delete(LinkList &L,int i){LNode *p;p=GetElem(L,i-1);LNode *q;q=(LNode *)malloc(sizeof(LNode));q=p->next;p->next=q->next;free(q);return L;
}LinkList List_Delete2(LinkList &L,LNode *p){LNode *q;q=(LNode *)malloc(sizeof(LNode));q=p->next;p->data=p->next->data;p->next=q->next;free(q);return L;
}
int main()
{LinkList L;List_TailInsert(L);List_Output(L);return 0;
}