cho.sh
Notes
Loading...

Distances

Time limit

1s

Memory limit

256 MB

Problem

There are several ways to define the distance between two points in the plane.

The Euclidean distance is the length of the straight line segment connecting the two points. In this problem, Euclidean distances are output as squared values.

The Manhattan distance is the sum of the absolute difference of the x-coordinates and the absolute difference of the y-coordinates. It can be viewed as the distance traveled when moving only parallel to the x-axis or the y-axis.

The Chebyshev distance is the larger of the absolute difference of the x-coordinates and the absolute difference of the y-coordinates.

You are given N distinct points in the two-dimensional plane. For each of these three distance measures, find the distance between the farthest pair of points and the distance between the closest pair of points.

Input

The first line contains the number of points N (2 ≤ N ≤ 100,000).

Each of the next N lines contains two integers, the x-coordinate and y-coordinate of one point, separated by a space. All points are distinct, and the absolute value of every coordinate is at most 10,000.

Output

Print six lines.

The first line must contain the square of the maximum Euclidean distance. The second line must contain the square of the minimum Euclidean distance. The third line must contain the maximum Manhattan distance. The fourth line must contain the minimum Manhattan distance. The fifth line must contain the maximum Chebyshev distance. The sixth line must contain the minimum Chebyshev distance.