Indexing Lines with Higher Endpoints

I’m creating a procedural cross-lap script that converts any surface into a series of ribs that can be laser cut. I have pairs of planes that intersect with these ribs. I then find the intersections, resulting in pairs of lines. I pull out the end points of these lines. As you can see, they are in tight pairs. I need to index out the line in each pair that is higher up, as its endpoint will be used to construct a rectangle that cuts through the rib, resulting notches for cross-lapping. To do this, I’ve extracted the xyz of each endpoint, and am now trying to figure out how to index the points with the greatest z value for each pair. I’ve tried using the Maximum component but it does not return the index of the item, so I can’t generate a list of indexes to filter out the lines corresponding the higher endpoint
Procedural Cross Lap.gh (77.0 KB)

you could do something like this, where each couple of Curves are inserted in a different branches with grafted Merge, then extract their end-point z-coordinate and sort those (in ascending order)

Curves are sorted simultaneously:

Procedural Cross Lap_Re.gh (73.3 KB)

then, if you want to pick only the Curves for which the end point coordinate is lower, you can just List item (first item is always the smaller)

a note, you can zoom-in the Sort component and add more simultaneously-sorted inputs if needed: