#include<stdio.h>
#include<stdlib.h>
typedef struct tree
{
int num;
struct tree *lchild,*rchild;
}tree;
tree *creatree()
{
int num;
tree *T;
scanf("%d",&num);
if(num==0)
T=NULL;
else
{
T=(tree*)malloc(sizeof(tree));
T->num=num;
T->lchild=creatree();
T->rchild=creatree();
}
return T;
}
void visit(tree *T)
{
if(T!=NULL)
{
printf("%d\t",T->num);
visit(T->lchild);
visit(T->rchild);
}
}
int main()
{
tree *T;
T=creatree();
visit(T);
puts(" ");
// system("pause");
return 0;
}