merging annotation paths into a tree