#include<iostream>
using namespace std;

struct tree{
	int item;
	struct tree *next;
};
		tree *creat_tree(int );
		void insert_top(tree *&,int);
		void show(tree *);
tree *creat_tree(int x){
	tree *p;
	p=new tree;
	p->item=x;
	p->next=NULL;
	return p;
}
void insert_top(tree *&p,int x){
	tree *q;
	q=creat_tree(x);
	q->next=p;
	p=q;
	return;
}
void insert_bottom(tree *p,int x){
	tree *q,*r;
	q=creat_tree(x);
	r=p;
	while(r->next!=NULL){
		r=r->next;
	}
	r->next=q; //show(q);
}
void show(tree *p){
	tree *q;
	//q=new tree;
	q=p;
	while(q){
	cout<<q->item<<" - ";
	q=q->next;
	}
}
main(){
	tree *p;
	p=creat_tree(0);
	insert_top(p,1);
	insert_top(p,2);
	insert_bottom(p,3);
	show(p);
}
