Public Judge

pjudge

时间限制: 1 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#21692. 【NOIP Round #3】Removing Stones

统计

You are playing a game called "Remove Stones."

There are $n$ stones on a 2D Cartesian coordinate plane, placed at integer coordinates (points where both the x and y coordinates are integers). The $i$-th stone is at $(x_i, y_i)$. It is guaranteed that the coordinates of the $n$ stones are distinct and that $n$ is even.

You need to control a robot to remove all the stones. You must perform exactly $n/2$ operations. In each operation:

  • First, you draw a square on the plane. The sides of the square must be parallel to the coordinate axes. The vertices of the square do not have to be integer points.
  • The robot removes all stones inside (including on the boundary of) the square.

Since the robot has two mechanical arms, and you do not want the robot to be too idle or too tired, you are required to have exactly two stones inside each square you draw. This also means that after all operations are completed, all stones have been removed.

Once a stone is removed, it is no longer on the plane and will not affect subsequent operations; you can think of them as being thrown into a trash bin.

You want to know if there exists a valid strategy. If it exists, please output any one valid strategy.

Input

The input contains multiple test cases.

The first line contains a positive integer $T$, representing the number of test cases.

For each test case: The first line contains a positive integer $n$, representing the number of stones.

The next $n$ lines each contain two integers $x_i, y_i$, describing the coordinates of a stone.

Output

For each test case:

If no strategy exists, output No.

Otherwise, output Yes on the first line.

Then, output $n/2$ lines. The $i$-th line should contain four real numbers $x_1, y_1, x_2, y_2$. $(x_1, y_1)$ and $(x_2, y_2)$ are any two opposite vertices of the square you draw in the $i$-th operation. You must output them in the order of the operations.

The output real numbers should:

  • Be in decimal form; scientific notation is not allowed.
  • Have at most four decimal places.

If there are multiple solutions, you may output any one of them. The strings No and Yes are case-insensitive (e.g., YES or nO are also accepted).

Examples

Input 1

1
4
1 1
2 2
5 5
6 6

Output 1

Yes
2 2 5 5.0000
1 1 6 6.000

Note

In the first operation, we removed the second and third stones. In the second operation, we removed the first and fourth stones.

The output is not unique. For example, the following output is also valid:

yEs
0.9999 0.9999 2.0001 2.0001
-233 -1.0 233.000 465.00

In the output above, the first operation removes the first and second stones, and the second operation removes the third and fourth stones.

However, the following output is invalid:

Yes
1 1 2 2
-1e+5 -1e+5 1e+6 1e+6

Because scientific notation cannot be used.

The following output is also invalid:

Yes
1 1 5 5
2 2 6 6

Because in the first operation, there are $3$ points $(1,1), (2,2), (5,5)$ inside or on the boundary of the square.

The following output is also invalid:

Yes
1 1 1 2
5 5 6 6

Because $(1,1)$ and $(1,2)$ cannot be the opposite vertices of any square with sides parallel to the coordinate axes.

The following output is also invalid:

Yes
1 1 2 2
5 5 6 6.00000

Because at most 4 decimal places are allowed.

Input 2

1
4
0 0
100000000 200000000
200000000 100000000
400000000 400000000

Output 2

Yes
100000000 100000000 200000000 200000000
-0.1 -0.100 400000000.0 400000000.0

Note

Note that outputting real numbers in scientific notation like 1e+8 or 1e8 is not allowed.

Constraints

There are $10$ test cases in this problem, each worth $10$ points. For all test cases, it is guaranteed that $1 \le T \le 60$, $2 \le n \le 3000$, and $0 \le x_i, y_i \le 10^9$. It is guaranteed that $n$ is even and all stone coordinates are distinct.

"Random data" in the table means that the x and y coordinates of the stones are generated randomly in $[0, 10^9]$.

Test Case ID $T \le$ $n \le$ Special Properties
$1, 2$ $1$ $6$ $x_i=2i, y_i=2i$
$3$ $3000$
$4$ $6$ $x_i=0$
$5$ $3000$
$6, 7$ $10$ Random data
$8, 9$ $20$ $500$
$10$ $60$ $3000$ None

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.