List match in Grasshopper

Hi, I know this is really a simple question. How can we match data as shown in photo very simply. I can do it in a very long way but I want my script to be very short and efficient.
Question.gh (9.4 KB)

Flip Matrix component

1 Like

Many thanks- worked well. I was thinking something along the line of tree path and etc that I always have problem with that.