#ABC215F. [ABC215F] Dist Max 2

[ABC215F] Dist Max 2

Score : 500500 points

Problem Statement

Given are NN distinct points in a two-dimensional plane. Point ii (1iN)(1 \leq i \leq N) has the coordinates (xi,yi)(x_i,y_i).

Let us define the distance between two points ii and jj be min(xixj,yiyj)\mathrm{min} (|x_i-x_j|,|y_i-y_j|): the smaller of the difference in the xx-coordinates and the difference in the yy-coordinates.

Find the maximum distance between two different points.

Constraints

  • 2N2000002 \leq N \leq 200000
  • 0xi,yi1090 \leq x_i,y_i \leq 10^9
  • (xi,yi)(x_i,y_i) \neq (xj,yj)(x_j,y_j) (ij)(i \neq j)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

x1x_1 y1y_1

x2x_2 y2y_2

\vdots

xNx_N yNy_N

Output

Print the maximum distance between two different points.

3
0 3
3 1
4 10
4

The distances between Points 11 and 22, between Points 11 and 33, and between Points 22 and 33 are 22, 44, and 11, respectively, so your output should be 44.

4
0 1
0 4
0 10
0 6
0
8
897 729
802 969
765 184
992 887
1 104
521 641
220 909
380 378
801