#P9820. Chaos Begin

Chaos Begin

Chaos Begin

Problem Description

Long long ago, there were nn points a1,a2,,ana_1,a_2,\dots,a_n on the 2D plane. The world keeps stable for a long time. However, it begins to be chaotic recently when another nn points b1,b2,,bnb_1,b_2,\dots,b_n appeared, where bi=ai+(Δx,Δy)b_i=a_i+(\Delta x,\Delta y). And now, these 2n2n points have already lost their identifiers. You are given these 2n2n points in an arbitrary order, you need to figure out all the possible (Δx,Δy)(\Delta x,\Delta y) to help the world recover from chaos.

Input

The first line contains a single integer TT (1T1001 \leq T \leq 100), the number of test cases. For each test case: The first line of the input contains a single integer nn (1n500001 \leq n \leq 50\,000), denoting the number of initial points. In the next 2n2n lines, the ii-th line contains two integers xix_i and yiy_i (xi,yi108|x_i|,|y_i|\leq 10^8), describing the coordinate of a current point. It is guaranteed that the x-coordinate and y-coordinate of each initial point are chosen uniformly at random from integers in [v,v][-v,v], where vv is chosen in [107,108][10^7,10^8]. The randomness condition does not apply to the sample test case, but your solution must pass the sample as well. It is also guaranteed that the sum of all nn is at most 300000300\,000.

Output

For each test case, first output a single line containing an integer kk, denoting the number of possible (Δx,Δy)(\Delta x,\Delta y). Then output kk lines, each line contains two integers Δx\Delta x and Δy\Delta y. It is guaranteed that k1k\geq 1, and when k2k\geq 2, you should print the answers in ascending order of Δx\Delta x, and then in ascending order of Δy\Delta y in case of a tie.

Sample Input

1
3
1 2
3 4
8 9
7 8
6 7
2 3

Sample Output

2
-5 -5
5 5

Source

2023“钉耙编程”中国大学生算法设计超级联赛(3)