You are given n segments, from which you need to remove the minimum number of segments so that the remaining segments do not have common interior points.
The number of segments in the first line, n(1≤n≤105).
The next n lines contain segments, ai,bi(1≤ai≤bi≤109).
Print the number of segments remaining after deletion.
In the following lines, print the segments themselves.
If there are multiple solutions, print any of them.
3 3 6 1 3 2 5
2 1 3 3 6
Login to be able to submit.