build the tree.