My respect, colleagues. I have a list of segments which may include nested segments that should be deleted.
For example we have a list (or maybe other data structure) of tuples:
[(50, 60), (10, 20), (10, 40), (40, 60), (60, 80), (75, 95), (95, 100)]
Or maybe list of ranges:
[range(50, 60), range(10, 20), range(10, 40), range(40, 60), range(60, 80), range(75, 95), range(95, 100)]
The result should be:
[(10, 40), (40, 60), (60, 80), (75, 95), (95, 100)]
And I must delete all nested segments.
In addition, I am not allowed to use any libraries or even import's.
Actually, I'm confused, so I'll be very grateful for any help.

(50, 60), (10, 20)be deleted? What is the logic for removing elements?[(50, 60), (10, 20), (10, 100)], what should be the result?