# include<stdio.h>
# include<stdlib.h>
typedef struct Plnode{
int data;
struct Plnode *next;
}Lnode,*linklist;
int m=sizeof(Lnode);
//创建链表
linklist Creat(linklist head,int n)
{
int i;
linklist p,s;
p=head;
for(i=0;i<n;i++)
{
s=(linklist)malloc(m);
scanf("%d",&s->data);
s->next=p->next;
p->next=s;
p=s;
}
return head;
}
//删除某个节点
void Delete(linklist head,int x)
{
linklist p,q;
p=head;
q=p->next;
while(q->data!=x&&q!=NULL)
{
p=p->next;
q=q->next;
}
p->next=q->next;
}
//修改某个节点
void Change(linklist head,int a,int b)
{
linklist p;
int count=1;
p=head;
p=p->next;
while(count<a)
{
p=p->next;
count++;
}
p->data=b;
}
//插入节点
void Insert(linklist head)
{
linklist p,s;
p=head;
while(p->next!=NULL)
p=p->next;
s=(linklist)malloc(m);
scanf("%d",&s->data);
s->next=p->next;
p->next=s;
}
//输出链表
void display(linklist head)
{
linklist p;
p=head;
p=p->next;
while(p)
{
printf("%d\n",p->data);
p=p->next;
}
}
int main()
{
linklist head;
int a,b,n;
head=(linklist)malloc(m);
head->next=NULL;
scanf("%d",&n);
head=Creat(head,n);
//scanf("%d",&m);
//Delete(head,m);
//scanf("%d%d",&a,&b);
//Change(head,a,b);
Insert(head);
display(head);
return 0;
}