CPython lite logoProblemsContests

2073. Covering

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.


Input

The number of segments in the first line, n(1n105).

The next n lines contain segments, ai,bi(1aibi109).

Output

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.


Sample input 1

3
3 6
1 3
2 5

Sample output 1

2
1 3
3 6

Login to be able to submit.

HardData structuresArray
11 / 15
Solved / unsolved count
1.0 s / 256 MB
Limits