convert AHC to tree