Equinox Roller Coaster

Given stable grid points, find the largest axis-aligned square whose four corners are all stable points, and output its side length.

Medium7Hash mapGeometryBrute forceSortingNo attempts yetTime limit5sMemory limit512 MB

Problem

Equiroaster, short for EQUInox ROller coASTER, is a large attraction that the park will build on the neighboring field next year.

The name comes from this being the first roller coaster whose construction and shape are tied directly to astronomical events. Twice a year, at the equinoxes, visitors ride it with extra visual effects. The park also expects a high advertising return from the equinox rides.

To meet those expectations, Equiroaster must be built very precisely. The tracks must line up exactly with the East-West direction. Four main piers carry the tracks, and the side joining the southern pair and the side joining the northern pair must line up with the East-West direction just as exactly.

The building site sits right next to the other park attractions. The site geology is suspected to be less than favorable for a large building project, so the park commissioned a detailed survey. A grid aligned exactly with the East-West direction (equivalently, with the North-South direction) was projected onto the field, with grid points one meter apart. The survey marked every grid point as stable or unstable.

All four main piers must stand on stable grid points. The park hopes the field holds enough stable grid points to allow a very large design. The building technology requires the bases of the four piers to form a perfect square, which is what reliably supports the massive weight. Because of the alignment above, the four sides of that square are parallel to the grid axes.

Find the greatest distance between the two piers on one side that still satisfies every condition.

Input

The input holds several test cases and ends at the end of the file. Each test case starts with a line containing one integer NN, the number of stable grid points (1N1000001 \le N \le 100000). Each of the next NN lines contains the xx coordinate and the yy coordinate of one grid point. The grid axes are aligned with the East-West and South-North directions, and the coordinates are whole meters. All grid points in one test case are distinct. The absolute value of each coordinate is at most 10910^9.

Output

For each test case, print one line with one integer, the greatest possible distance in meters between the centers of two piers on one side of the coaster. If the piers cannot be placed on stable grid points as specified, print 0.