#include <iostream>
using namespace std;
struct LinkNode
{
int data;
LinkNode *next;
};
void init(LinkNode *&head) //初始化头结点
{
head=new LinkNode;
head->next=NULL;
}
void create(LinkNode *&head) //创建链表
{
LinkNode *p;
while(1)
{
p=new LinkNode;
cin>>p->data;
if(p->data < 0)
break;
p->next=head->next;
head->next=p;
}
}
void show(LinkNode *p)
{
cout<<endl;
while(p)
{
cout<<p->data<<" ";
p=p->next;
}
cour<<endl;
}
int main ()
{
LinkNode *head;
init(head);
create(head);
show(head->next);
return 0;
}