Misaka Mikoto is the third-ranked Level 5 esper in
Academy City and has been nicknamed
Railgun due to her signature move. One day, several evil robots invade Academy City and Misaka is planning to terminate all of them.
Consider Academy City as a 2-dimensional plane. There are

robots in total and the position of the

-th robot is

. Misaka will start moving from

and her railgun ability will terminate all robots sharing the same

- or

-coordinate with her. More formally, if Misaka is now located at

, all robots whose

or

will be terminated.
As Misaka hates decimals and Euclidean geometry, she will only move from one integer point to another integer point and can only move horizontally (parallel to the

-axis) or vertically (parallel to the

-axis). As moving among the city is quite tiresome, Misaka asks you to calculate the minimum distance she has to move to terminate all robots.
Recall that an integer point is a point whose

-coordinate and

-coordinate are both integers.
输入描述:
There are multiple test cases. The first line of the input contains an integer
indicating the number of test cases. For each test case:
The first line contains an integer
(
indicating the number of robots.
For the following
lines, the
-th line contains two integers
and
(
) indicating the position of the
-th robot.
It is guaranteed that the sum of
of all test cases will not exceed
.
输出描述:
For each test case output one line containing one integer indicating the minimum distance Misaka needs to move to terminate all robots.
示例1
输入
复制
3
2
0 1
1 0
4
1 1
-2 2
-3 -3
4 -4
3
1 100
-100 1
3 3
备注:
For the second sample test case, Misaka should first go to
, then to
, then to
, then to
.
For the third sample test case, Misaka should first go to
, then to
, then to
.