407882: GYM102916 F Exactly One Point
Description
There are $$$n$$$ segments on a line. You should place some points onto this line so that:
- every point is contained in at least one segment,
- every segment contains exactly one point.
The first line contains an integer $$$n$$$ ($$$1 \le n \le 200000$$$) — the number of segments.
Each of the next $$$n$$$ lines contains two integers $$$L_i$$$ and $$$R_i$$$ ($$$L_i < R_i$$$) — the endpoints of the $$$i$$$-th segment.
For convenience, all endpoints of all segments are even numbers from $$$0$$$ to $$$4n - 2$$$.
OutputIf it's impossible to place points in a required way, output "-1".
Otherwise, in the first line output an integer $$$m$$$ — the number of points that should be placed onto the line.
In the next line, output $$$m$$$ distinct integers from $$$0$$$ to $$$4n - 2$$$ — the coordinates of the points.
You don't have to minimize the number of points. If there are several possible solutions, output any of them.
ExamplesInput3Output
0 10
2 4
6 8
-1Input
2Output
0 6
2 4
1Input
4
3Output
0 2
2 4
4 6
3
1 3 6