merging trees