reorder_by_three_exchanges_with_segment_flipping() works, but it is excessively slow, with close to O(n^3) time complexity. Commited, but not used in production until sped up.