시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 1 1 1 100.000%

문제

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$.

출력

If 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.

예제 입력 1

3
0 10
2 4
6 8

예제 출력 1

-1

예제 입력 2

2
0 6
2 4

예제 출력 2

1
4

예제 입력 3

3
0 2
2 4
4 6

예제 출력 3

3
1 3 6