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

문제

Consider a set of points. You can move directly between two points if their x-coordinates are the same or their y-coordinates are the same. A set of points is called nice if for any two points in the set, the length of the shortest (direct or indirect) path is equal to the manhattan distance between them.

You are given $N$ points. The $i$-th point is at $(x_i, y_i)$.

You are allowed to add up to $10000 - N$ points. Convert the given set of points into a nice set.

입력

$N$
$x_1$  $y_1$
$x_2$ $y_2$
$\vdots$
$x_N$ $y_N$

출력

Let $M (0 \leq M \leq 10000 - N)$ be the number of added points, and $(s_1, t_1), \ldots, (s_M, t_M)$ be their coordinates. After adding these $M$ points to the set, you get $N + M$ points. These $N+M$ points must be pairwise distinct, and this set must be nice. The coordinates must be integers.

Output the answer in the following format.

$M$
$s_1$ $t_1$
$s_2$ $t_2$
$\vdots$
$s_N$ $t_M$

If there are multiple possible solutions, output any.

제한

  • $2 \leq N \leq 1000$
  • $1 \leq x_i, y_i \leq 1000$
  • The points are pairwise distinct.
  • Under these constraints, it is guaranteed that at least one solution exists.
  • All values in the input are integers.

예제 입력 1

2
1 1
2 2

예제 출력 1

1
1 2

예제 입력 2

4
1 1
2 2
3 4
4 3

예제 출력 2

4
1 2
3 2
3 3
4 4

예제 입력 3

7
2 4
3 2
4 6
5 1
6 5
7 3
8 7

예제 출력 3

15
3 6
8 5
2 2
7 5
2 5
6 6
3 1
5 6
6 2
6 1
7 1
7 2
2 3
6 7
2 6

힌트

In Sample 1, if you add $(1, 2)$, you can move between $(1, 1)$ and $(2, 2)$ via $(1, 2)$.