Curve Nearest Reversing Order

I am trying to group surfaces based on their proximity to a group of curves I want the branches to maintain the same order as the list of curves.

While trying to do this using “curve nearest” node, the branches are grouping in the reverse order as I have the curves. Any thoughts on why this is happening?

Curve Nearest.3dm (10.1 MB)
Curver (116.1 KB)

Check this

Curver (51.9 KB)