题目描述
Problem Background
Xiao Ben knows that the coordinates in Minecraft have three parameters: $X$, $Y$, and $Z$. However, in Xiao Ben's perspective, there is a fourth parameter $Q$, representing the fondness for the coordinates. For example, some locations are Xiao Ben's home, and the value of $Q$ is high, while some places are dangerous mines, so the value of $Q$ is low.
Problem Description
There are $N$ coordinates. For the parameters of the $i$-th coordinate $\{Xi, Yi, Zi, Qi\}$ and the $j$-th coordinate $\{Xj, Yj, Zj, Qj\}$, if $Xi - Xj = Yi - Yj = Zi - Zj = Qi - Qj$, then this coordinate is called an elegant coordinate. Given $N$ coordinates, Xiao Ben wants to know the minimum value of $j - i$ and the maximum value of $i + j$ for all elegant coordinates. Can you help him?
Input Format
The input consists of $n + 1$ lines. The first line is a number $n$, followed by $n$ lines, each containing four integers $X$, $Y$, $Z$, and $Q$.
Output Format
The output consists of a single line, including the minimum value of $j - i$ and the maximum value of $i + j$, separated by a space. The data guarantees a solution.
Sample Input and Output
Input Sample #1
7
1 2 3 4
2 3 4 5
1 4 3 3
5 2 3 5
2 4 5 6
1 4 3 3
2 5 4 4
Output Sample #1
1 13
Input Sample #2
10
1 4 3 2
4 4 4 4
2 3 4 5
1 1 1 1
1 2 3 1
3 4 2 1
2 4 5 2
8 9 7 6
0 0 0 0
1 2 3 4
Output Sample #2
2 14
Notes
Sample 1 Explanation:
(1,2,3,4) and (2,3,4,5) or (1,4,3,3) and (2,5,4,4) form the minimum value.
(1,4,3,3) and (2,5,4,4), where 6 + 7 = 13 is the maximum value.
Data Scale and Constraints
For $30\%$ of the data, $n \leq 10^3$;
For $100\%$ of the data, $n \leq 5 \times 10^5$, and $X$, $Y$, $Z$, $Q$ are all within the int range.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分