#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//结构体
struct node
{
int data; //数值域
struct node *next; //指针域
};
//建立链表
struct node *creat(int n)
{
struct node *head,*tail,*p; //头指针,尾指针,自由指针
head=(struct node *)malloc(sizeof(struct node));
tail=head;
int i;
for(i=1; i<=n; i++)
{
p=(struct node *)malloc(sizeof(struct node));
scanf("%d",&p->data);
p->next=NULL;
tail->next=p;
tail=p;
}
return head;
}
//输出函数
void print(struct node *head)
{
struct node *p;
p=head->next;
int m=0;
while(p)
{
m++;
if(m==1)printf("%d",p->data);
else printf(" %d",p->data);
p=p->next;
}
}
//主函数
int main()
{
int n;
scanf("%d",&n);
struct node *h;
h=creat(n);
print(h);
return 0;
}