generate tree.