Task
Giorgio recently became very passionate about Feng Shui, the art of harmonizing everyone with the surrounding environment, and decided to rebuild his home from scratch in order to optimize his harmony with the universe.
First, he searched his yard for geomagnetic nodes, producing a list of points with coordinates . Now, he needs to select four of those points such that together they will form a perfect square whose sides are aligned with the cardinal axes. These points will determine the perimeter of his new home.
However, it is not easy to examine such a long list and as of now Giorgio has only found few very small valid squares, not really fit to contain a whole house. Help Giorgio find the largest square that obeys the Feng Shui principles!
Input data
The first line contains the only integer . The subsequent lines contain two integers , each.
Output data
You need to write a single line with an integer: the maximum side length for a Feng Shui compliant house.
Constraints and clarifications
- .
- for each .
- There exists at least one Feng Shui compliant square.
- There are no repeated points in the list.
# | Points | Constraints |
---|---|---|
1 | 5 | Examples. |
2 | 35 | |
3 | 30 | |
4 | 30 | No additional limitations |
Example 1
stdin
6
0 10
20 10
10 10
10 0
10 20
0 0
stdout
10
Explanation
In the first sample case, there is only one square aligned with the axes. Another larger square would be possible, but it would not be aligned with the axes.
Example 2
stdin
6
0 0
0 100
100 0
100 100
200 0
200 100
stdout
100
Explanation
In the second sample case there are two possible squares of the same size.