Hide

Problem D
Divide the Ducks Equally

Languages en sv

As the benevolent ruler of POland, you want all your citizens to be happy. It is therefore deeply concerning that two children are quarreling. Specifically, they are arguing over $2N$ kodsport-ducks that are scattered across a plane, and the children disagree about how many ducks each should get.

To resolve the conflict, you need to create a crack in the ground — a straight line that divides the plane into two parts. The crack must be placed so that exactly $N$ ducks end up on each side, ensuring that both children receive the same number of ducks. Each duck is located at an integer coordinate.

Since you prefer simplicity and elegance, your crack will be a straight line of the form $y = kx + m$, where $k$ and $m$ may be decimal numbers.
If such a line exists that divides the ducks equally, output it.
Otherwise, print “impossible”.

Input

The first line contains an integer $N$ ($1 \leq N \leq 10^5$), where $2N$ is the total number of ducks.

The following $2N$ lines describe the ducks’ positions. Each line contains two integers $x_i, y_i$ ($0 \leq x_i, y_i \leq 10^6$), the coordinates of the $i$-th duck. All ducks have unique positions.

Output

If it is possible to divide the ducks equally, output two real numbers $k$ and $m$ that describe the line $y = kx + m$. $k$ and $m$ may contain at most 50 characters each. It is guaranteed that the judge will make calculations exactly with $k$ and $m$. Note that your program might round $k$ and $m$ when they are printed.
The answer will be accepted if the line divides the ducks into two equally sized groups. If multiple solutions exist, you may output any of them.
If a duck is exactly on the line, it is considered to be below the line.

If it is impossible to divide the ducks equally, print “impossible”.

Scoring

Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group you need to solve all test cases in the test group.

Group

Points

Constraints

$1$

$15$

$N = 1$

$2$

$15$

$x_i = 0$ for all ducks.

$3$

$15$

$x_i \leq 1$ for all ducks.

$4$

$15$

$N = 2$

$5$

$20$

$N \leq 1000$

$6$

$20$

No additional constraints.

Explanation of Samples

In each of the following images, all ducks are marked as black dots. The crack used in the sample solution is represented as a red line. Note that there are multiple valid solutions in all cases.

\includegraphics[width=0.3\textwidth ]{sample1.png}
Figure 1: The image represents the first sample.
\includegraphics[width=0.3\textwidth ]{sample2.png}
Figure 2: The image represents the second sample. It is hard to see, but the second point is just below the line.
\includegraphics[width=0.3\textwidth ]{sample3.png}
Figure 3: The image represents the third sample.
Sample Input 1 Sample Output 1
1
1 1
0 0
-1 1
Sample Input 2 Sample Output 2
2
0 4
5 4
2 2
1 4
-3 7.00001
Sample Input 3 Sample Output 3
29
11 21
12 22
13 23
14 23
15 23
16 23
17 22
18 21
18 20
19 19
19 18
19 17
19 16
18 15
18 14
17 13
18 13
19 13
20 13
21 13
22 13
23 13
24 14
25 14
24 13
24 12
23 11
22 10
21 9
20 8
19 7
18 7
17 7
16 7
15 7
14 7
13 7
12 7
11 8
10 9
10 10
10 11
10 12
11 13
12 14
13 14
14 15
15 16
14 17
13 17
12 17
11 17
10 17
9 17
8 17
10 18
11 19
11 20
2.5 -24.9