#P7871. Divide and Conquer(无SPJ)

Divide and Conquer(无SPJ)

Divide and Conquer

Problem Description

Given nn points in 2D plane, where n0(mod4)n \equiv 0 \pmod{4}, no two points coincide and no three points are collinear. Find two intersecting lines satisfying that no given points lie in the two lines and that for each of the four divided areas, there are exactly n4\frac{n}{4} given points. If multiple solutions exist, print any one of them. If no solution, print "-1" in one line.

Input

The first line contains one positive integer TT (1T201\le T \le 20), denoting the number of test cases. For each test case: The first line contains one integer n(4n50000)n\,(4 \le n \le 50000), denoting the number of given points. Following nn lines each contains two integers xi,yi(xi,yi106)x_i, y_i\,(|x_i|, |y_i| \le 10^6), denoting one given point (xi,yi)(x_i, y_i). It is guaranteed that n105,n0(mod4)\sum n \le 10^5, \, n \equiv 0 \pmod{4}, that no two points coincide and that no three points are collinear.

Output

For each test case: If no solution, print "-1" in one line. Else print two lines each containing four integers x1,y1,x2,y2((x1,y1)(x2,y2))x_1, y_1, x_2, y_2 \, ((x_1, y_1) \neq (x_2, y_2)) with absolute value not exceeding 10910^9, denoting one line passing (x1,y1),(x2,y2)(x_1, y_1), (x_2, y_2) simultaneously.

Sample Input

2
4
-1 -1
-1 1
1 -1
1 1
8
0 0
0 1
2 0
2 1
1 2
1 3
3 2
3 3

Sample Output

0 1 0 -1
1 0 -1 0
1 0 2 3
0 2 3 1

Source

2020 Multi-University Training Contest 10