#include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node *next;
};
void show (struct Node *x);
struct Node *Creat(struct Node *x,int n);
int main ()
{
struct Node head;
int n;
head=(struct Node)malloc (sizeof (struct Node ));
if (head= =NULL)
exit(0);
head->next=NULL;
while ((scanf("%d",&n))!=EOF)
{
if(n==-1)
{
show (head);
exit(0);
}
head=Creat(head,n);
}
return 0;
}
struct Node *Creat(struct Node *x,int n)
{
struct Node *head,p;
head=x;
p=(struct Node)malloc (sizeof(struct Node ));
if (p==NULL)
exit(0);
p->data =n;
p->next=head->next;
head->next =p;
return head;
}
void show (struct Node *x)
{
struct Node *p;
p=x->next ;
while (p!=NULL)
{
printf ("%d ",p->data );
p=p->next ;
}
}