#include <stdio.h>
#include <stdlib.h>
#include <time.h>

typedef struct tree{
	int key;
	struct tree *left;
	struct tree *right;
} tree;

tree * insert(tree *root, int new_value){
	if(root == NULL){
		root = (tree *)malloc(sizeof(tree));
		root->key = new_value;
		root->left = root->right = NULL;
		return root;
	}
	if(root->key > new_value)
		root->left  = insert(root->left, new_value);
	else
		root->right = insert(root->right, new_value);
}

void postorder(tree *root){
	if(root == NULL)
		return;
	postorder(root->left);
	postorder(root->right);
	printf("%d ", root->key);
}

int main(){
	int i, k;
	tree *root = NULL;

	srand(time(NULL));
	for(i = 0; i < 10; i++){
		k = rand() % 17;
		root = insert(root, k);
	}

	postorder(root);

	scanf("%d", &i);
}