#K83612. Maximum Package Delivery Time

    ID: 36237 Type: Default 1000ms 256MiB

Maximum Package Delivery Time

Maximum Package Delivery Time

You are given multiple test cases. In each test case, there are several packages with their starting and destination coordinates.

The time taken for a robot to deliver a package is equal to the Manhattan distance between the starting point and the destination, i.e. \( |x_2 - x_1| + |y_2 - y_1| \).

Your task is to compute the maximum delivery time for each test case.

Input Format: The first line contains an integer \( T \) representing the number of test cases. For each test case, the first line contains an integer \( N \) which is the number of packages. The following \( N \) lines each contain four space-separated integers: \( x_1 \), \( y_1 \), \( x_2 \), \( y_2 \).

Output Format: For each test case, output the maximum delivery time on a new line.

inputFormat

The input is given via standard input and has the following format:

T
N
x1 y1 x2 y2
x1 y1 x2 y2
... (N lines)
N
x1 y1 x2 y2
... (and so on for T test cases)

Where:

  • \( T \) is the number of test cases.
  • For each test case, \( N \) is the number of packages.
  • Each package is represented with four integers: \( x_1, y_1 \) being the starting coordinates and \( x_2, y_2 \) being the destination coordinates.

outputFormat

For each test case, output a single integer which is the maximum Manhattan distance among all packages in that test case. Each result should be printed on a new line.

## sample
2
2
0 0 1 1
2 3 5 6
3
1 2 3 4
2 2 2 1
1 1 1 1
6

4

</p>