AtCoder Beginner Contest 178 - Dist Max

There are N points on the 2D plane, i-th of which is located on (x_i, y_i).
There can be multiple points that share the same coordinate.
What is the maximum possible Manhattan distance between two distinct points?
Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.

-----Constraints-----
 - 2 \leq N \leq 2 \times 10^5
 - 1 \leq x_i,y_i \leq 10^9
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
x_1 y_1
x_2 y_2
:
x_N y_N

-----Output-----
Print the answer.

-----Sample Input-----
3
1 1
2 4
3 2

-----Sample Output-----
4

The Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.

Source: atcoder | Difficulty: MEDIUM


Solutions:
n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a.append(x + y)
	b.append(x - y)
a.sort()
b.sort()
ans = a[-1] - a[0]
c = b[-1] - b[0]
print(max(ans, c))


import re
import sys
import math
import itertools
import bisect
import heapq
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools

def v():
	return input()

def k():
	return int(input())

def S():
	return input().split()

def I():
	return list(map(int, input().split()))

def X():
	return list(input())

def L():
	return list(input().split())

def l():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
cnt = 0
ans = 0
num = []
inf = float('inf')
al = 'abcdefghijklmnopqrstuvwxyz'
AL = al.upper()
import numpy as np
from scipy.spatial.distance import euclidean, cityblock
n = k()
p = 0
a = []
b = []
for i in range(n):
	(A, B) = I()
	a.append(A)
	b.append(B)
z = []
w = []
for i in range(n):
	z.append(a[i] + b[i])
	w.append(a[i] - b[i])
print(max(max(z) - min(z), max(w) - min(w)))


n = int(input())
(f0, f1) = ([0] * n, [0] * n)
for i in range(n):
	(x, y) = map(int, input().split())
	f0[i] = x - y
	f1[i] = x + y
print(max(max(f0) - min(f0), max(f1) - min(f1)))


def mdmax(x):
	a = []
	b = []
	for i in range(len(x)):
		a.append(x[i][0] - x[i][1])
		b.append(x[i][0] + x[i][1])
	return max(max(a) - min(a), max(b) - min(b))
n = int(input())
data = []
for i in range(n):
	ininput_data = input()
	input_data = list(map(int, ininput_data.split()))
	data.append(input_data)
print(mdmax(data))


n = int(input())
maxa = maxb = -2000000000.0
mina = minb = 2000000000.0
for i in range(n):
	(x, y) = list(map(int, input().split()))
	maxa = max(maxa, x + y)
	mina = min(mina, x + y)
	maxb = max(maxb, x - y)
	minb = min(minb, x - y)
print(max(maxa - mina, maxb - minb))


n = int(input())
wa = []
sa = []
for i in range(n):
	(x, y) = map(int, input().split())
	wa.append(x + y)
	sa.append(x - y)
wa.sort()
sa.sort()
print(max(abs(wa[0] - wa[-1]), abs(sa[0] - sa[-1])))


n = int(input())
X = []
Y = []
for _ in range(n):
	(x, y) = map(int, input().split())
	X.append(x + y)
	Y.append(x - y)
(a, b, c, d) = (max(X), min(X), max(Y), min(Y))
print(max(abs(a - b), abs(c - d)))


def get_ints():
	return list(map(int, input().split()))
n = int(input())
(a, b) = ([], [])
for i in range(n):
	(x, y) = get_ints()
	a.append(x + y)
	b.append(x - y)
a.sort()
b.sort()
ans = max(a[-1] - a[0], b[-1] - b[0])
print(ans)


n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
ans = []
l = [xy[i][0] + xy[i][1] for i in range(n)]
ans.append(max(l) - min(l))
l = [xy[i][0] - xy[i][1] for i in range(n)]
ans.append(max(l) - min(l))
l = [-xy[i][0] + xy[i][1] for i in range(n)]
ans.append(max(l) - min(l))
l = [-xy[i][0] - xy[i][1] for i in range(n)]
ans.append(max(l) - min(l))
print(max(ans))


(a, *b) = ([],)
for z in [*open(0)][1:]:
	(x, y) = map(int, z.split())
	a += (x + y,)
	b += (x - y,)
print(max(abs(max(a) - min(a)), abs(max(b) - min(b))))


N = int(input())
xp = yp = 0
xn = yn = 10 ** 9
zs = [0] * N
ws = [0] * N
for i in range(N):
	(xi, yi) = map(int, input().split())
	zs[i] = xi + yi
	ws[i] = xi - yi
zs.sort()
ws.sort()
ans = max(zs[-1] - zs[0], ws[-1] - ws[0])
print(ans)


n = int(input())
l = []
ll = []
for i in range(n):
	(x, y) = map(int, input().split())
	l.append(x + y)
	ll.append(x - y)
l.sort()
ll.sort()
print(max(l[-1] - l[0], ll[-1] - ll[0]))


N = int(input())
add = []
diff = []
for _ in range(N):
	(x, y) = list(map(int, input().split()))
	add.append(x + y)
	diff.append(x - y)
add.sort()
diff.sort()
print(max(add[-1] - add[0], diff[-1] - diff[0]))


n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
X_ = []
Y_ = []
for (x, y) in XY:
	X_.append(x - y)
	Y_.append(x + y)
print(max(max(X_) - min(X_), max(Y_) - min(Y_)))


N = int(input())
(x, y) = map(int, input().split())
d = [x - y, x - y, x + y, x + y]
for i in range(1, N):
	(x, y) = map(int, input().split())
	d[0] = max(d[0], x - y)
	d[1] = min(d[1], x - y)
	d[2] = max(d[2], x + y)
	d[3] = min(d[3], x + y)
print(max(d[0] - d[1], d[2] - d[3]))


N = int(input())
x = []
y = []
for i in range(N):
	(b, c) = map(int, input().split(' '))
	x.append(b + c)
	y.append(b - c)
print(max([max(x) - min(x), max(y) - min(y)]))


N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
	(x, y) = map(int, input().split())
	A[i] = x + y
	B[i] = x - y
a = max(A) - min(A)
b = max(B) - min(B)
print(max(a, b))


n = int(input())
p_one = input()
p_one_list = p_one.split(' ')
zmax = int(p_one_list[0]) + int(p_one_list[1])
zmin = int(p_one_list[0]) + int(p_one_list[1])
wmax = int(p_one_list[0]) - int(p_one_list[1])
wmin = int(p_one_list[0]) - int(p_one_list[1])
for i in range(1, n):
	line = input()
	tmp = line.split(' ')
	z = int(tmp[0]) + int(tmp[1])
	w = int(tmp[0]) - int(tmp[1])
	zmax = max(zmax, z)
	wmax = max(wmax, w)
	zmin = min(zmin, z)
	wmin = min(wmin, w)
z_ans = zmax - zmin
w_ans = wmax - wmin
print(f'{max(z_ans, w_ans)}')


N = int(input())
p = [list(map(int, input().split())) for _ in range(N)]
z = []
w = []
for i in range(N):
	z.append(p[i][0] + p[i][1])
	w.append(p[i][0] - p[i][1])
print(max(max(z) - min(z), max(w) - min(w)))


n = int(input())
a = []
b = []
for _ in range(n):
	(x, y) = map(int, input().split())
	a += (x + y,)
	b += (x - y,)
c = max(a) - min(a)
d = max(b) - min(b)
ans = max(c, d, -c, -d)
print(ans)


n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
a = [x + y for (x, y) in xy]
b = [x - y for (x, y) in xy]
ans = max(max(a) - min(a), max(b) - min(b))
print(ans)


n = int(input())
d0 = []
d1 = []
for i in range(n):
	(xi, yi) = map(int, input().split())
	d0.append(xi - yi)
	d1.append(xi + yi)
print(max(max(d0) - min(d0), max(d1) - min(d1)))


n = int(input())
xy1 = []
xy2 = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xy1.append(x + y)
	xy2.append(x - y)
ans = max(max(xy1) - min(xy1), max(xy2) - min(xy2))
print(ans)


def solve(n, x, y):
	z = [u + v for (u, v) in zip(x, y)]
	w = [u - v for (u, v) in zip(x, y)]
	return max([max(z) - min(z), max(w) - min(w)])
n = int(input())
(x, y) = zip(*[map(int, input().split()) for i in range(n)])
print(solve(n, x, y))


N = int(input())
XYs = [[], []]
for _ in range(N):
	(x, y) = map(int, input().split())
	XYs[0].append(x - y)
	XYs[1].append(x + y)
print(max(max(XYs[0]) - min(XYs[0]), max(XYs[1]) - min(XYs[1])))


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
k = []
m = []
for i in l:
	(a, b) = i
	k.append(a + b)
	m.append(a - b)
k.sort()
m.sort()
print(max([k[-1] - k[0], m[-1] - m[0]]))


n = int(input())
p = []
m = []
for i in range(n):
	(x, y) = map(int, input().split())
	p.append(x + y)
	m.append(x - y)
p.sort()
m.sort()
print(max(p[-1] - p[0], m[-1] - m[0]))


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
(w, z) = ([], [])
for (x, y) in XY:
	w.append(x - y)
	z.append(x + y)
(a, b) = (max(w) - min(w), max(z) - min(z))
print(max(a, b))


n = int(input())
s = []
t = []
for i in range(n):
	(x, y) = map(int, input().split())
	s.append(x + y)
	t.append(x - y)
print(max(max(s) - min(s), max(t) - min(t)))


N = int(input())
A = list()
B = list()
for i in range(N):
	(x, y) = map(int, input().split())
	A.append(x + y)
	B.append(x - y)
s = max(A) - min(A)
t = max(B) - min(B)
print(max(s, t))


(m, *p) = ([],)
for i in [*open(0)][1:]:
	(x, y) = map(int, i.split())
	m += (x - y,)
	p += (x + y,)
a = max
print(a(a(m) - min(m), a(p) - min(p)))


n = int(input())
z = []
w = []
for i in range(n):
	(x, y) = map(int, input().split())
	z.append(x + y)
	w.append(x - y)
print(max(abs(max(z) - min(z)), abs(max(w) - min(w))))


n = int(input())
a = []
j = k = 0

def s(a):
	return a[0] + a[1]

def ss(a):
	return a[0] - a[1]
for i in range(n):
	f = list(map(int, input().split()))
	a.append(f)
aa = min(map(s, a))
b = max(map(s, a))
c = min(map(ss, a))
d = max(map(ss, a))
print(max(abs(d - c), abs(b - aa)))


n = int(input())
plus = []
minus = []
for _ in range(n):
	(x, y) = map(int, input().split())
	plus.append(x + y)
	minus.append(x - y)
plus.sort()
minus.sort()
print(max(plus[-1] - plus[0], minus[-1] - minus[0]))


n = int(input())
a = []
b = []
for _ in range(n):
	(x, y) = map(int, input().split())
	a += [x - y]
	b += [x + y]
a.sort()
b.sort()
print(max(a[-1] - a[0], b[-1] - b[0]))


N = int(input())
z = []
zz = []
for _ in range(N):
	(x, y) = map(int, input().split())
	zz.append(x - y)
	z.append(x + y)
z.sort()
zz.sort()
ans = z[-1] - z[0]
ans = max(ans, zz[-1] - zz[0])
print(ans)


((n,), *d) = [[*map(int, o.split())] for o in open(0)]
M = [[x - y for (x, y) in d], [x + y for (x, y) in d]]
print(max((max(M[d]) - min(M[d]) for d in [0, 1])))


N = int(input())
x = [0 for _ in range(N)]
y = [0 for _ in range(N)]
for i in range(N):
	(x[i], y[i]) = map(int, input().split())
X = [0 for _ in range(N)]
Y = [0 for _ in range(N)]
for i in range(N):
	(X[i], Y[i]) = (x[i] - y[i], x[i] + y[i])
ans = 0
ans = max(max(X) - min(X), max(Y) - min(Y))
print(ans)


N = int(input())
L = [list(map(int, input().split())) for i in range(N)]
zmax = zmin = L[0][0] + L[0][1]
wmax = wmin = L[0][0] - L[0][1]
for (a, b) in L:
	(z, w) = (a + b, a - b)
	zmax = max(zmax, z)
	zmin = min(zmin, z)
	wmax = max(wmax, w)
	wmin = min(wmin, w)
print(max(zmax - zmin, wmax - wmin))


N = int(input())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	A.append(a + b)
	B.append(a - b)
A.sort()
B.sort()
ans = max(A[-1] - A[0], B[-1] - B[0])
print(ans)


n = int(input())
ph = 0
pl = 10 ** 10
mh = -10 ** 10
ml = 10 ** 10
for _ in range(n):
	(x, y) = map(int, input().split())
	ph = max(ph, x + y)
	pl = min(pl, x + y)
	mh = max(mh, x - y)
	ml = min(ml, x - y)
print(max(ph - pl, mh - ml))


N = int(input())
ls = []
lt = []
for _ in range(N):
	(x, y) = map(int, input().split())
	s = x + y
	t = x - y
	ls.append(s)
	lt.append(t)
print(max(max(ls) - min(ls), max(lt) - min(lt)))


n = int(input())
(zl, wl) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	z = x + y
	w = x - y
	zl.append(z)
	wl.append(w)
zl.sort()
wl.sort()
print(max(zl[-1] - zl[0], wl[-1] - wl[0]))


(n, *XY) = map(int, open(0).read().split())
(X, Y) = (XY[::2], XY[1::2])
A = [x + y for (x, y) in zip(X, Y)]
B = [x - y for (x, y) in zip(X, Y)]
A.sort()
B.sort()
print(max(A[-1] - A[0], B[-1] - B[0]))


N = int(input())
u = []
v = []
for _ in range(N):
	(x, y) = map(int, input().split())
	u.append(x + y)
	v.append(x - y)
umax = max(u)
umin = min(u)
vmax = max(v)
vmin = min(v)
print(max(umax - umin, vmax - vmin))


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
p = [a + b for (a, b) in l]
q = [a - b for (a, b) in l]
p.sort()
q.sort()
print(max(p[-1] - p[0], q[-1] - q[0]))


import sys

def Ii():
	return int(sys.stdin.readline())

def Mi():
	return map(int, sys.stdin.readline().split())

def Li():
	return list(map(int, sys.stdin.readline().split()))
n = Ii()
ans = 0
points = []
xymax = 0
xymin = 10 ** 11
dxymax = -10 ** 11
dxymin = 10 ** 11
for i in range(n):
	point = Li()
	xy = point[0] + point[1]
	if xy > xymax:
		xymax = xy
	if xy < xymin:
		xymin = xy
	dxy = point[0] - point[1]
	if dxy > dxymax:
		dxymax = dxy
	if dxy < dxymin:
		dxymin = dxy
ans = max(dxymax - dxymin, xymax - xymin)
print(ans)


n = int(input())
p = []
q = []
for _ in range(n):
	(x, y) = map(int, input().split())
	p.append(x + y)
	q.append(x - y)
print(max(max(p) - min(p), max(q) - min(q)))


N = int(input())
XY = [[int(_) for _ in input().split()] for _ in range(N)]
ans = -1
for (dx, dy) in ((1, 1), (-1, 1), (-1, -1), (1, -1)):
	xy2 = [x * dx + y * dy for (x, y) in XY]
	ans = max(ans, max(xy2) - min(xy2))
print(ans)


n = int(input())
X = []
Y = []
for i in range(n):
	(x, y) = map(int, input().split())
	X.append(x + y)
	Y.append(x - y)
ans = max(max(X) - min(X), max(Y) - min(Y))
print(ans)


n = int(input())
(a, b) = ([], [])
for _ in range(n):
	(x, y) = list(map(int, input().split()))
	a.append(x - y)
	b.append(x + y)
ans = max(max(a) - min(a), max(b) - min(b))
print(ans)


import sys
left_right_max = 0
left_right_min = float('inf')
right_left_max = float('-inf')
right_left_min = float('inf')
r3_max = float('-inf')
r3_min = float('inf')
n = int(sys.stdin.readline().strip())
for idx in range(n):
	(x, y) = sys.stdin.readline().strip().split(' ')
	x = int(x)
	y = int(y)
	left_right_tmp = x + y
	if left_right_tmp > left_right_max:
		left_right_max = left_right_tmp
	if left_right_tmp < left_right_min:
		left_right_min = left_right_tmp
	right_left_tmp = x - y
	if right_left_tmp > right_left_max:
		right_left_max = right_left_tmp
	if right_left_tmp < right_left_min:
		right_left_min = right_left_tmp
	r3_tmp = y - x
	if r3_tmp > r3_max:
		r3_max = r3_tmp
	if r3_tmp < r3_min:
		r3_min = r3_tmp
print(max(left_right_max - left_right_min, right_left_max - right_left_min, r3_max - r3_min))


n = int(input())
M = []
N = []
for i in range(n):
	(x, y) = map(int, input().split())
	M.append(x + y)
	N.append(x - y)
p = max(M) - min(M)
q = max(N) - min(N)
print(max(p, q))


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
a = []
b = []
for i in range(n):
	a.append(l[i][0] + l[i][1])
	b.append(l[i][0] - l[i][1])
print(max(max(a) - min(a), max(b) - min(b)))


import sys
import re
import queue
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def lcm(a, b):
	return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	N = i_input()
	x_y_list = []
	for i in range(0, N):
		(tmpx, tmpy) = i_map()
		x_y_list.append((tmpx, tmpy))
	z_list = []
	w_list = []
	for i in range(0, N):
		tmpz = x_y_list[i][0] + x_y_list[i][1]
		tmpw = x_y_list[i][0] - x_y_list[i][1]
		z_list.append(tmpz)
		w_list.append(tmpw)
	print(max(max(map(lambda x: x, z_list)) - min(map(lambda x: x, z_list)), max(map(lambda x: x, w_list)) - min(map(lambda x: x, w_list))))
	return

def __starting_point():
	main()
__starting_point()


n = int(input())
z = [0 for _ in range(n)]
w = [0 for _ in range(n)]
for i in range(n):
	(x, y) = map(int, input().split())
	(z[i], w[i]) = (x + y, x - y)
print(max(max(z) - min(z), max(w) - min(w)))


n = int(input())
lx = []
ly = []
for i in range(n):
	(x, y) = map(int, input().split())
	lx.append(x + y)
	ly.append(x - y)
(ax, bx, ay, by) = (max(lx), min(lx), max(ly), min(ly))
print(max(ax - bx, ay - by))


x = []
y = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x.append(a - b)
	y.append(a + b)
print(max(max(x) - min(x), max(y) - min(y)))


import sys
input = sys.stdin.readline
n = int(input())
(a, b, c, d) = (-10 ** 9, 10 ** 9, -10 ** 9, 10 ** 9)
for _ in range(n):
	(x, y) = map(int, input().split())
	a = max(a, x + y)
	b = min(b, x + y)
	c = max(c, x - y)
	d = min(d, x - y)
print(max(a - b, c - d))


n = int(input())
ans = []
ans1 = []
for _ in range(n):
	(a, b) = map(int, input().split())
	d = a - b
	c = a + b
	ans.append(c)
	ans1.append(d)
m = min(ans)
M = max(ans)
P = M - m
Q = max(ans1) - min(ans1)
print(max(P, Q))


n = int(input())
xy = []
for index in range(n):
	(x, y) = map(int, input().split())
	xy.append([x, y])
pos_max = xy[0][0] + xy[0][1]
pos_min = xy[0][0] + xy[0][1]
neg_max = xy[0][0] - xy[0][1]
neg_min = xy[0][0] - xy[0][1]
for item in xy:
	pos_v = item[0] + item[1]
	neg_v = item[0] - item[1]
	pos_max = pos_v if pos_v > pos_max else pos_max
	pos_min = pos_v if pos_v < pos_min else pos_min
	neg_max = neg_v if neg_v > neg_max else neg_max
	neg_min = neg_v if neg_v < neg_min else neg_min
pos_result = pos_max - pos_min
neg_result = neg_max - neg_min
print(pos_result if pos_result >= neg_result else neg_result)


N = int(input())
(a, b) = ([], [])
for i in range(N):
	(x, y) = map(int, input().split())
	a.append(x + y)
	b.append(x - y)
a.sort()
b.sort()
ans = max(a[-1] - a[0], b[-1] - b[0])
print(ans)


def main():
	n = int(input())
	ls = []
	for i in range(n):
		p = list(map(int, input().split()))
		np = (p[0] + p[1], p[0] - p[1])
		ls.append(np)
	minx = float('inf')
	miny = float('inf')
	maxx = -float('inf')
	maxy = -float('inf')
	for i in range(len(ls)):
		(x, y) = ls[i]
		minx = min(minx, x)
		miny = min(miny, y)
		maxx = max(maxx, x)
		maxy = max(maxy, y)
	print(max(maxx - minx, maxy - miny))
main()


n = int(input())
l = [0] * n
k = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	l[i] = x + y
	k[i] = x - y
print(max(abs(max(l) - min(l)), abs(min(l) - max(l)), abs(max(k) - min(k)), abs(min(k) - max(k))))


def main():
	n = int(input())
	pt = []
	for _ in range(n):
		(x, y) = map(int, input().split())
		pt.append([x, y])
	(a, b, c) = ([], [], [])
	for p in pt:
		a.append(p[0] + p[1])
		b.append(p[0] - p[1])
		c.append(p[1] - p[0])
	ans = 0
	if max(a) - min(a) > ans:
		ans = max(a) - min(a)
	if max(b) - min(b) > ans:
		ans = max(b) - min(b)
	if max(c) - min(c) > ans:
		ans = max(c) - min(c)
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
p = [0 for _ in range(n)]
m = [0 for _ in range(n)]
for i in range(n):
	(xi, yi) = map(int, input().split())
	p[i] = xi + yi
	m[i] = xi - yi
p.sort()
m.sort()
print(max(p[-1] - p[0], m[-1] - m[0]))


import sys

def solve():
	input = sys.stdin.readline
	N = int(input())
	dx = []
	dy = []
	for _ in range(N):
		(x, y) = map(int, input().split())
		dx.append(x + y)
		dy.append(x - y)
	dx.sort()
	dy.sort()
	print(max(dx[N - 1] - dx[0], dy[N - 1] - dy[0]))
	return

def __starting_point():
	solve()
__starting_point()


def main():
	N = int(input())
	(x, y) = list(map(int, input().split()))
	a1 = x + y
	a2 = x + y
	b1 = y - x
	b2 = y - x
	N -= 1
	while N != 0:
		(x, y) = list(map(int, input().split()))
		a1 = max(a1, x + y)
		a2 = min(a2, x + y)
		b1 = max(b1, y - x)
		b2 = min(b2, y - x)
		N = N - 1
	print(max(a1 - a2, b1 - b2))
main()


(_, *Z) = open(0)
(A, B) = ([], [])
for z in Z:
	(x, y) = map(int, z.split())
	A += [x + y]
	B += [x - y]
print(max(max(A) - min(A), max(B) - min(B)))


n = int(input())
(z, w) = ([], [])
for _ in range(n):
	(x, y) = map(int, input().split())
	z.append(x + y)
	w.append(x - y)
print(max(max(z) - min(z), max(w) - min(w)))


N = int(input())
z = [None] * N
w = [None] * N
for i in range(N):
	(x, y) = map(int, input().split())
	z[i] = x + y
	w[i] = x - y
print(max(max(z) - min(z), max(w) - min(w)))


N = int(input())
xy = []
(d0, d1) = ([], [])
for _ in range(N):
	(x, y) = map(int, input().split())
	d0.append(x - y)
	d1.append(x + y)
print(max(max(d0) - min(d0), max(d1) - min(d1)))


n = int(input())
u = []
v = []
for _ in range(n):
	(x, y) = list(map(int, input().split()))
	u.append(x + y)
	v.append(x - y)
ans = max(max(u) - min(u), max(v) - min(v))
print(ans)


def get_points_and_convert(pts):
	(x, y) = pts
	return (x + y, x - y)

def main():
	n = int(input())
	points = [get_points_and_convert(list(map(int, input().split()))) for _ in range(n)]
	(plus_coords, minus_coords) = list(zip(*points))
	plus_dist = max(plus_coords) - min(plus_coords)
	minus_dist = max(minus_coords) - min(minus_coords)
	print(max(plus_dist, minus_dist))

def __starting_point():
	main()
__starting_point()


n = int(input())
raw = []
p = []
m = []
for _ in range(n):
	(x, y) = map(int, input().split())
	p.append(x + y)
	m.append(x - y)
print(max(max(p) - min(p), max(m) - min(m)))


N = int(input())
A = [list(map(int, input().split(' '))) for i in range(N)]
hoge = [sum(a) for a in A]
fuga = [a[0] - a[1] for a in A]
print(max(max(hoge) - min(hoge), max(fuga) - min(fuga)))


N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]
z = []
w = []
for (x, y) in xy:
	z.append(x + y)
	w.append(x - y)
print(max(max(z) - min(z), max(w) - min(w)))


import sys
from operator import itemgetter
N = int(input())
V = set()
for s in sys.stdin.readlines():
	(x, y) = list(map(int, s.split()))
	V.add((x + y, x - y))
y_max = max(V, key=itemgetter(1))[1]
y_min = min(V, key=itemgetter(1))[1]
x_max = max(V, key=itemgetter(0))[0]
x_min = min(V, key=itemgetter(0))[0]
print(max(x_max - x_min, y_max - y_min))


n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
q = [[x + y, x - y] for (x, y) in p]
print(max(max(q)[0] - min(q)[0], max(q, key=lambda x: x[1])[1] - min(q, key=lambda x: x[1])[1]))


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
L1 = [i[0] + i[1] for i in xy]
L2 = [i[0] - i[1] for i in xy]
m1 = max(L1) - min(L1)
m2 = max(L2) - min(L2)
print(max(m1, m2))


n = int(input())
xy = [list(map(int, input().split())) for _i in range(n)]
x = [i + j for (i, j) in xy]
y = [i - j for (i, j) in xy]
x.sort()
y.sort()
print(max(abs(x[0] - x[-1]), abs(y[0] - y[-1])))


n = int(input())
min_u = float('inf')
max_u = -float('inf')
min_v = float('inf')
max_v = -float('inf')
for i in range(n):
	(x, y) = list(map(int, input().split()))
	(u, v) = (x + y, x - y)
	if u <= min_u:
		min_u = u
	if u >= max_u:
		max_u = u
	if v <= min_v:
		min_v = v
	if v >= max_v:
		max_v = v
print(max(max_u - min_u, max_v - min_v))


N = int(input())
X = [0] * N
Y = [0] * N
for TN in range(0, N):
	(A, B) = (int(T) for T in input().split())
	X[TN] = A - B
	Y[TN] = A + B
print(max(max(X) - min(X), max(Y) - min(Y)))


n = int(input())
xy_1 = [0] * n
xy_2 = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	xy_1[i] = x + y
	xy_2[i] = x - y
print(max(max(xy_1) - min(xy_1), max(xy_2) - min(xy_2)))


import numpy as np

def solve(n, x, y):
	x = np.asarray(x)
	y = np.asarray(y)
	z = x + y
	w = x - y
	return max(np.max(z) - np.min(z), np.max(w) - np.min(w))
n = int(input())
(x, y) = list(zip(*[list(map(int, input().split())) for i in range(n)]))
print(solve(n, x, y))


N = int(input())
W = []
S = []
for _ in range(N):
	(x, y) = [int(hoge) for hoge in input().split()]
	wa = x + y
	sa = x - y
	W.append(wa)
	S.append(sa)
T = max(W) - min(W)
Y = max(S) - min(S)
print(max(T, Y))


n = int(input())
zp = []
zl = []
for i in range(n):
	(a, b) = map(int, input().split())
	zp.append(a + b)
	zl.append(a - b)
ans = max(max(zp) - min(zp), max(zl) - min(zl))
print(ans)


n = int(input())
P = []
M = []
for i in range(n):
	(x, y) = map(int, input().split())
	P.append(x + y)
	M.append(x - y)
dP = abs(max(P) - min(P))
dM = abs(max(M) - min(M))
print(max(dP, dM))


N = int(input())
L = [[int(l) for l in input().split()] for _ in range(N)]
L1 = [0] * N
L2 = [0] * N
for i in range(N):
	L1[i] = L[i][0] + L[i][1]
	L2[i] = L[i][0] - L[i][1]
L1.sort()
L2.sort()
print(max(L1[-1] - L1[0], L2[-1] - L2[0]))


(N, *f) = map(int, open(0).read().split())
xy = [f[i * 2:i * 2 + 2] for i in range(N)]
s = [sum(z) for z in xy]
a = max(s) - min(s)
t = [z[0] - z[1] for z in xy]
b = max(t) - min(t)
print(max(a, b))


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = (int(i) for i in input().split())
	a.append(x - y)
	b.append(x + y)
a.sort()
b.sort()
print(max(a[-1] - a[0], b[-1] - b[0]))


N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
	(a, b) = map(int, input().split())
	x[i] = a + b
	y[i] = a - b
xmax = max(x)
xmin = min(x)
ymax = max(y)
ymin = min(y)
print(max(xmax - xmin, ymax - ymin))


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
f0 = []
f1 = []
for i in XY:
	f0.append(i[0] - i[1])
	f1.append(i[0] + i[1])
print(max(max(f0) - min(f0), max(f1) - min(f1)))


import sys
readline = sys.stdin.readline
N = int(readline())
(X, Y) = ([None] * N, [None] * N)
for i in range(N):
	(x, y) = list(map(int, readline().split()))
	(X[i], Y[i]) = (x + y, x - y)
print(max(abs(max(X) - min(X)), abs(max(Y) - min(Y))))


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
a = 10 ** 9
z_max = -1 * a
z_min = a
w_max = -1 * a
w_min = a
for (x, y) in l:
	z_max = max(z_max, x + y)
	z_min = min(z_min, x + y)
	w_max = max(w_max, x - y)
	w_min = min(w_min, x - y)
print(max(z_max - z_min, w_max - w_min))


n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
z = list(map(lambda x: x[0] + x[1], xy))
w = list(map(lambda x: x[0] - x[1], xy))
print(max(max(z) - min(z), max(w) - min(w)))


import sys

def input():
	return sys.stdin.readline()[:-1]
N = int(input())
plus = []
minus = []
for _ in range(N):
	(x, y) = list(map(int, input().split()))
	plus.append(x + y)
	minus.append(x - y)
print(max(max(plus) - min(plus), max(minus) - min(minus)))


n = int(input())
x = [0] * n
y = [0] * n
z = []
w = []
for i in range(n):
	(x[i], y[i]) = list(map(int, input().strip().split()))
	z.append(x[i] + y[i])
	w.append(x[i] - y[i])
a = max(z) - min(z)
b = max(w) - min(w)
print(max(a, b))


N = int(input())
axis1 = []
axis2 = []
for i in range(N):
	(x, y) = map(int, input().split())
	axis1.append(x + y)
	axis2.append(x - y)
a1 = max(axis1) - min(axis1)
a2 = max(axis2) - min(axis2)
print(max(a1, a2))


N = int(input())
A = []
B = []
for i in range(N):
	(x, y) = list(map(int, input().split()))
	A.append(x + y)
	B.append(-x + y)
A.sort()
B.sort()
print(max(abs(A[0] - A[-1]), abs(B[0] - B[-1])))


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
XplusY = [x + y for (x, y) in XY]
XminusY = [x - y for (x, y) in XY]
print(max([max(XplusY) - min(XplusY), max(XminusY) - min(XminusY)]))


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
add = sorted([x + y for (x, y) in xy])
sub = sorted([x - y for (x, y) in xy])
print(max(add[-1] - add[0], sub[-1] - sub[0]))


N = int(input())
u = []
v = []
for i in range(N):
	(x, y) = map(int, input().split())
	u.append(x + y)
	v.append(x - y)
print(max(max(u) - min(u), max(v) - min(v)))


N = int(input())
nodes = []
plus = []
minus = []
for i in range(N):
	(x, y) = map(int, input().split())
	nodes.append((x, y))
	plus.append(x + y)
	minus.append(x - y)
print(max(max(plus) - min(plus), max(minus) - min(minus)))


n = int(input())
a = []
b = []
for c in range(n):
	(x, y) = map(int, input().split())
	a.append(x + y)
	b.append(x - y)
s1 = max(a) - min(a)
s2 = max(b) - min(b)
print(max(s1, s2))


N = int(input())
p = [0] * N
m = [0] * N
for i in range(N):
	(x, y) = map(int, input().split())
	p[i] = x + y
	m[i] = x - y
pm = max(p) - min(p)
mm = max(m) - min(m)
print(max(pm, mm))


N = int(input())
(L1, L2) = ([], [])
for i in range(N):
	l = list(map(int, input().split()))
	L1.append(l[0] - l[1])
	L2.append(l[0] + l[1])
ans = max(max(L1) - min(L1), max(L2) - min(L2))
print(ans)


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
f0 = sorted([x + y for (x, y) in xy])
f1 = sorted([x - y for (x, y) in xy])
print(max(f0[-1] - f0[0], f1[-1] - f1[0]))


(n, *XY) = map(int, open(0).read().split())
XY = list(zip(XY[::2], XY[1::2]))
A = [x + y for (x, y) in XY]
B = [x - y for (x, y) in XY]
print(max(max(A) - min(A), max(B) - min(B)))


n = int(input())
x = []
y = []
for i in range(n):
	l = list(map(int, input().split()))
	x.append(l[0] + l[1])
	y.append(l[0] - l[1])
print(max(max(x) - min(x), max(y) - min(y)))


N = int(input())
xys = [list(map(int, input().split())) for _ in range(N)]
ws = [x + y for (x, y) in xys]
zs = [x - y for (x, y) in xys]
print(max([max(ws) - min(ws), max(zs) - min(zs)]))


N = int(input())
xyp = []
xym = []
for _ in range(N):
	(x, y) = map(int, input().split())
	xyp.append(x + y)
	xym.append(x - y)
xyp.sort()
xym.sort()
print(max(xyp[-1] - xyp[0], xym[-1] - xym[0]))


n = int(input())
lx = []
ly = []
for i in range(n):
	(x, y) = map(int, input().split())
	lx.append(x + y)
	ly.append(x - y)
print(max(max(lx) - min(lx), max(ly) - min(ly)))


n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
plus = [p[0] + p[1] for p in points]
minus = [p[0] - p[1] for p in points]
print(max(max(plus) - min(plus), max(minus) - min(minus)))


n = int(input())
zmi = wmi = int(10000000000.0)
zma = wma = int(-10000000000.0)
for i in range(n):
	(xi, yi) = list(map(int, input().split()))
	zma = max(xi + yi, zma)
	wma = max(xi - yi, wma)
	zmi = min(xi + yi, zmi)
	wmi = min(xi - yi, wmi)
print(max(zma - zmi, wma - wmi))


N = int(input())
xpy = [0] * N
xmy = [0] * N
for i in range(N):
	(x, y) = map(int, input().split())
	xpy[i] = x + y
	xmy[i] = x - y
xpy.sort()
xmy.sort()
print(max(xpy[-1] - xpy[0], xmy[-1] - xmy[0]))


N = int(input())
plus = []
minus = []
for _ in range(N):
	(x, y) = map(int, input().split())
	plus.append(x + y)
	minus.append(x - y)
print(max(max(plus) - min(plus), max(minus) - min(minus)))


N = int(input())
Z = []
W = []
for i in range(N):
	(x, y) = map(int, input().split())
	Z.append(x + y)
	W.append(x - y)
print(max(max(Z) - min(Z), max(W) - min(W)))


n = int(input())
a = []
b = []
for s in range(n):
	(x, y) = map(int, input().split())
	a.append(x + y)
	b.append(x - y)
c = max(a) - min(a)
d = max(b) - min(b)
if c < d:
	c = d
print(c)


n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
d1 = []
d2 = []
for (x, y) in xy:
	d1.append(x - y)
	d2.append(x + y)
ans1 = max(d1) - min(d1)
ans2 = max(d2) - min(d2)
print(max(ans1, ans2))


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
fn = [lambda x: x[0] + x[1], lambda x: x[0] - x[1]]
ans = 0
for f in fn:
	xy.sort(key=f)
	ans = max(ans, abs(f(xy[0]) - f(xy[-1])))
print(ans)


n = int(input())
(x, y) = ([], [])
for i in range(n):
	(xi, yi) = map(int, input().split())
	x.append(xi + yi)
	y.append(xi - yi)
x.sort()
y.sort()
ans = max(x[-1] - x[0], y[-1] - y[0])
print(ans)


N = int(input())
z = [0] * N
w = [0] * N
for n in range(N):
	(x, y) = map(int, input().split())
	z[n] = x + y
	w[n] = x - y
print(max(max(z) - min(z), max(w) - min(w)))


n = int(input())
d1 = []
d2 = []
for i in range(n):
	(x, y) = map(int, input().split())
	d1.append(x - y)
	d2.append(x + y)
one = max(d1) - min(d1)
two = max(d2) - min(d2)
print(max(one, two))


N = int(input())
axis1 = []
axis2 = []
for i in range(N):
	(x, y) = map(int, input().split())
	axis1.append(x - y)
	axis2.append(x + y)
ans1 = max(axis1) - min(axis1)
ans2 = max(axis2) - min(axis2)
print(max(ans1, ans2))


def ans():
	N = int(input())
	Z = []
	W = []
	for _ in range(N):
		(x, y) = map(int, input().split())
		Z.append(x + y)
		W.append(x - y)
	(z_max, z_min) = (max(Z), min(Z))
	(w_max, w_min) = (max(W), min(W))
	max_d = max((z_max - z_min, w_max - w_min))
	print(max_d)

def __starting_point():
	ans()
__starting_point()


N = int(input())
A = []
B = []
for _ in range(N):
	(x, y) = map(int, input().split())
	A.append(x + y)
	B.append(x - y)
A = sorted(A)
B = sorted(B)
print(max(A[-1] - A[0], B[-1] - A[0], A[-1] - A[0], B[-1] - B[0]))


n = int(input())
ad = [0] * n
su = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	ad[i] = x + y
	su[i] = x - y
ad.sort()
su.sort()
print(max(ad[-1] - ad[0], su[-1] - su[0]))


n = int(input())
i = []
for z in range(n):
	i.append([int(s) for s in input().split()])
ur = [ind[0] + ind[1] for ind in i]
ul = [ind[0] - ind[1] for ind in i]
print(max([max(ur) - min(ur), max(ul) - min(ul)]))


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
p = [x + y for (x, y) in xy]
a1 = max(p) - min(p)
q = [x - y for (x, y) in xy]
a2 = max(q) - min(q)
print(max(a1, a2))


N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
z = [x + y for (x, y) in X]
w = [x - y for (x, y) in X]
print(max(max(z) - min(z), max(w) - min(w)))


n = int(input())
(a, b, c, d) = (2 * 10 ** 9, 0, 10 ** 9, -10 ** 9)
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a = min(a, x + y)
	b = max(b, x + y)
	c = min(c, y - x)
	d = max(d, y - x)
print(max(b - a, d - c))


N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
	(A[i], B[i]) = map(int, input().split())
C = [a + b for (a, b) in zip(A, B)]
D = [a - b for (a, b) in zip(A, B)]
print(max(max(C) - min(C), max(D) - min(D)))


n = int(input())
u = []
v = []
ans = 0
for i in range(n):
	(x, y) = map(int, input().split())
	u.append(x + y)
	v.append(x - y)
ans = max(max(u) - min(u), max(v) - min(v))
print(ans)


n = int(input())
s = []
m = []
for i in range(n):
	(a, b) = map(int, input().split())
	s.append(a + b)
	m.append(a - b)
print(max(max(s) - min(s), max(m) - min(m)))


n = int(input())
(s, p) = (10 ** 100, 10 ** 100)
(t, q) = (-1000000000000, -1000000000000)
for i in range(n):
	(x, y) = map(int, input().split())
	s = min(s, x + y)
	t = max(t, x + y)
	p = min(p, x - y)
	q = max(q, x - y)
print(max(t - s, q - p))


n = int(input())
disadd = []
disminus = []
for i in range(n):
	(x, y) = map(int, input().split())
	disadd.append(x + y)
	disminus.append(x - y)
print(max(max(disadd) - min(disadd), max(disminus) - min(disminus)))


n = int(input())
wa = [0] * n
sa = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	wa[i] = x + y
	sa[i] = x - y
wanosa = max(wa) - min(wa)
sanosa = max(sa) - min(sa)
ans = max(wanosa, sanosa)
print(ans)


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
z = [x + y for (x, y) in xy]
w = [x - y for (x, y) in xy]
z.sort()
w.sort()
ans = max(z[-1] - z[0], w[-1] - w[0])
print(ans)


l = [list(map(int, input().split())) for _ in range(int(input()))]
f = sorted([x + y for (x, y) in l])
g = sorted([x - y for (x, y) in l])
print(max(f[-1] - f[0], g[-1] - g[0]))


N = int(input())
lst = []
for i in range(N):
	lst.append(tuple(map(lambda i: int(i), input().split())))
lstP = [xy[0] + xy[1] for xy in lst]
lstM = [xy[0] - xy[1] for xy in lst]
(lstP, lstM)
z = max(lstP) - min(lstP)
w = max(lstM) - min(lstM)
print(max(z, w))


N = int(input())
i = []
j = []
for k in range(N):
	(x, y) = map(int, input().split())
	i.append(x + y)
	j.append(x - y)
print(max(max(i) - min(i), max(j) - min(j)))


n = int(input())
z = [0] * n
w = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	z[i] = x + y
	w[i] = x - y
a = max(z)
b = min(z)
c = max(w)
d = min(w)
print(max(a - b, b - a, c - d, d - c))


n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
	(p, q) = [int(j) for j in input().split(' ')]
	a[i] = p + q
	b[i] = p - q
a.sort()
b.sort()
print(max(a[-1] - a[0], b[-1] - b[0]))


n = int(input())
xx = []
yy = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xx.append(x + y)
	yy.append(x - y)
print(max(max(xx) - min(xx), max(yy) - min(yy)))


n = int(input())
xy_array = [list(map(int, input().split())) for _ in range(n)]
th = pow(10, 9)
right_up_max = -th
left_down_min = th
left_up_max = -th
right_down_min = th
for (x, y) in xy_array:
	right_up_max = max(x + y, right_up_max)
	left_down_min = min(x + y, left_down_min)
	left_up_max = max(x - y, left_up_max)
	right_down_min = min(x - y, right_down_min)
ans = max(right_up_max - left_down_min, left_up_max - right_down_min)
print(ans)


N = int(input())
x_y = [list(map(int, input().split())) for _ in range(N)]
Z = []
W = []
for l in x_y:
	Z.append(l[0] + l[1])
	W.append(l[0] - l[1])
print(max(max(Z) - min(Z), max(W) - min(W)))


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x + y)
	b.append(x - y)
print(max(max(a) - min(a), max(b) - min(b)))


n = int(input())
xs = []
ys = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xs.append(x + y)
	ys.append(x - y)
xs.sort()
ys.sort()
ans = max(xs[-1] - xs[0], ys[-1] - ys[0])
print(ans)


def manhattan(n, x, y):
	x2 = [0] * n
	y2 = [0] * n
	for i in range(n):
		x2[i] = x[i] - y[i]
		y2[i] = x[i] + y[i]
	print(max(max(x2) - min(x2), max(y2) - min(y2)))
n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = list(map(int, input().split()))
manhattan(n, x, y)


N = int(input())
P = []
for i in range(N):
	(x, y) = map(int, input().split())
	P.append([x, y])
(L, R) = ([], [])
F = 10 ** 9
for (a, b) in P:
	L.append(a + b)
	R.append(F - b + a)
print(max(max(L) - min(L), max(R) - min(R)))


N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
Z = sorted([x + y for (x, y) in A])
W = sorted([x - y for (x, y) in A])
print(max(Z[-1] - Z[0], W[-1] - W[0]))


N = int(input())
Z = [0] * N
W = [0] * N
for i in range(N):
	(x, y) = map(int, input().split())
	Z[i] = x + y
	W[i] = x - y
alpha = max(Z) - min(Z)
beta = max(W) - min(W)
print(max(alpha, beta))


sumi = []
diff = []
t = int(input())
for _ in range(t):
	z = list(map(int, input().split()))
	sumi.append(z[0] + z[1])
	diff.append(z[0] - z[1])
print(max(max(diff) - min(diff), max(sumi) - min(sumi)))


n = int(input())
Xs = []
Ys = []
for _ in range(n):
	(x, y) = map(int, input().split())
	Xs.append(x + y)
	Ys.append(x - y)
Xs.sort()
Ys.sort()
print(max(Xs[-1] - Xs[0], Ys[-1] - Ys[0]))


def main():
	n = int(input())
	(xym, xyM, x_ym, x_yM) = (10 ** 9, -10 ** 9, 10 ** 9, -10 ** 9)
	for _ in range(n):
		(x, y) = map(int, input().split())
		(xy, x_y) = (x + y, x - y)
		(xym, xyM, x_ym, x_yM) = (min(xym, xy), max(xyM, xy), min(x_ym, x_y), max(x_yM, x_y))
	print(max(xyM - xym, x_yM - x_ym))

def __starting_point():
	main()
__starting_point()


N = int(input())
xpy = []
xmy = []
for _ in range(N):
	(x, y) = map(int, input().split())
	xpy.append(x + y)
	xmy.append(x - y)
print(max(max(xpy) - min(xpy), max(xmy) - min(xmy)))


n = int(input())
arr1 = []
arr2 = []
for i in range(n):
	(x, y) = map(int, input().split())
	arr1.append(x - y)
	arr2.append(x + y)
ma2 = max(arr2) - min(arr2)
ma1 = max(arr1) - min(arr1)
print(max(ma1, ma2))


N = int(input())
xy = [list(map(int, input().split())) for i in range(N)]
z = [x + y for (x, y) in xy]
w = [x - y for (x, y) in xy]
print(max(max(z) - min(z), max(w) - min(w)))


n = int(input())
r = []
for _ in range(n):
	(a, b) = map(int, input().split())
	r.append([a + b, a - b])
r = list(zip(*r))
print(max(max(r[0]) - min(r[0]), max(r[1]) - min(r[1])))


n = int(input())
arr1 = [0] * n
arr2 = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	arr1[i] = x + y
	arr2[i] = x - y
arr1 = sorted(arr1)
p = arr1[-1] - arr1[0]
arr2 = sorted(arr2)
q = arr2[-1] - arr2[0]
print(max(p, q))


N = int(input())
P = [tuple(map(int, input().split())) for i in range(N)]
X = [x + y for (x, y) in P]
Y = [x - y for (x, y) in P]
print(max(max(X) - min(X), max(Y) - min(Y)))


n = int(input())
XY = [tuple(map(int, input().split())) for i in range(n)]
A = [x + y for (x, y) in XY]
B = [x - y for (x, y) in XY]
print(max(max(A) - min(A), max(B) - min(B)))


n = int(input())
l1 = []
l2 = []
for _ in range(n):
	(x, y) = map(int, input().split())
	l1.append(x + y)
	l2.append(x - y)
print(max(max(l1) - min(l1), max(l2) - min(l2)))


import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp
INF = inf
MOD = 1000000007
n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]
tmp = 0
res = 0
ul = INF
ur = INF
bl = INF
br = INF
ul_index = 0
ur_index = 0
bl_index = 1
br_index = 1
for i in range(n):
	(x, y) = A[i]
	if x + 10000000000.0 - y <= ul:
		ul = x + 10000000000.0 - y
		ul_index = i
	if 10000000000.0 - x + 10000000000.0 - y <= ur:
		ur = 10000000000.0 - x + 10000000000.0 - y
		ur_index = i
	if x + y <= bl:
		bl = x + y
		bl_index = i
	if 10000000000.0 - x + y <= br:
		br = 10000000000.0 - x + y
		br_index = i
res = max(abs(A[ul_index][0] - A[br_index][0]) + abs(A[ul_index][1] - A[br_index][1]), abs(A[ur_index][0] - A[bl_index][0]) + abs(A[ur_index][1] - A[bl_index][1]))
print(res)


n = int(input())
xpy = []
xmy = []
for i in range(n):
	(x, y) = map(int, input().split())
	xpy.append(x + y)
	xmy.append(x - y)
xpy.sort()
xmy.sort()
print(max(abs(xpy[0] - xpy[-1]), abs(xmy[0] - xmy[-1])))


n = int(input())
(l, l2) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	l.append(x + y)
	l2.append(x - y)
print(max(max(l) - min(l), max(l2) - min(l2)))


import sys
readline = sys.stdin.readline
N = int(readline())
A = []
B = []
for _ in range(N):
	(x, y) = map(int, readline().split())
	A.append(x - y)
	B.append(x + y)
print(max(max(A) - min(A), max(B) - min(B)))


N = int(input())
l0 = [[int(i) for i in input().split()] for _ in range(N)]
l1 = [0] * N
l2 = [0] * N
for (cnt, val) in enumerate(l0):
	l1[cnt] = val[0] + val[1]
	l2[cnt] = val[0] - val[1]
l1.sort()
l2.sort()
print(max(l1[-1] - l1[0], l2[-1] - l2[0]))


import numpy as np
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy45 = [[xy[i][0] - xy[i][1], xy[i][0] + xy[i][1]] for i in range(N)]
xy45 = np.array(xy45)
print(max(max(xy45[:, 0]) - min(xy45[:, 0]), max(xy45[:, 1]) - min(xy45[:, 1])))


N = int(input())
XY = []
for n in range(N):
	(x, y) = (int(i) for i in input().split())
	XY.append([x, y])
plus = []
minus = []
for [x, y] in XY:
	plus.append(x + y)
	minus.append(x - y)
print(max(max(plus) - min(plus), max(minus) - min(minus)))


n = int(input())
z = []
c = []
for j in range(n):
	(x1, y1) = [int(j) for j in input().split()]
	z.append(x1 + y1)
	c.append(x1 - y1)
za = max(z)
zi = min(z)
ca = max(c)
ci = min(c)
mx = max(za - zi, ca - ci)
print(mx)


N = int(input())
data1 = []
data2 = []
for i in range(N):
	(x, y) = map(int, input().split())
	data1.append(x + y)
	data2.append(y - x)
p = max(data1) - min(data1)
q = max(data2) - min(data2)
print(max(p, q))


import sys
input = sys.stdin.readline
N = int(input())
(l1, l2) = ([], [])
for _ in range(N):
	(x, y) = map(int, input().split())
	l1.append(x + y)
	l2.append(x - y)
print(max(max(l1) - min(l1), max(l2) - min(l2)))


n = int(input())
l_x = []
l_y = []
for i in range(n):
	(x, y) = map(int, input().split())
	l_x.append(x + y)
	l_y.append(x - y)
tmpx = max(l_x) - min(l_x)
tmpy = max(l_y) - min(l_y)
if tmpx > tmpy:
	print(tmpx)
else:
	print(tmpy)


n = int(input())
l = [[] for i in range(4)]
for i in range(n):
	(x, y) = list(map(int, input().split()))
	l[0].append(x + y)
	l[1].append(x - y)
	l[2].append(-x + y)
	l[3].append(-x - y)
for i in range(4):
	l[i].sort()
ans = 0
for i in range(4):
	ans = max(ans, l[i][-1] - l[i][0])
print(ans)


import sys

def input() -> str:
	return sys.stdin.readline()[:-1]

def calc(p1: list, p2: list) -> int:
	return abs(p2[1] - p1[1]) + abs(p2[0] - p1[0])

def main():
	n = int(input())
	patterns = {'lt': (1, 1), 'rt': (-1, 1), 'lb': (-1, -1), 'rb': (1, -1)}
	points: dict = {k: None for k in list(patterns.keys())}
	for _ in range(n):
		p = list(map(int, input().split(' ')))
		for (k, (x, y)) in list(patterns.items()):
			max_p = points[k]
			if max_p:
				max_p_pos = max_p[0] * x + max_p[1] * y
				p_pos = p[0] * x + p[1] * y
				if max_p_pos < p_pos:
					points[k] = p
			else:
				points[k] = p
	ans = 0
	for (i, p1) in enumerate(points.values()):
		for p2 in list(points.values())[i + 1:]:
			ans = max(ans, calc(p1, p2))
	print(ans)
main()


n = int(input())
alist = []
blist = []
for i in range(n):
	(x, y) = map(int, input().split())
	alist.append(x + y)
	blist.append(x - y)
print(max(max(alist) - min(alist), max(blist) - min(blist)))


def main():
	n = int(input())
	z = [[], []]
	for i in range(n):
		(x, y) = list(map(int, input().split()))
		z[0].append(x + y)
		z[1].append(x - y)
	z[0] = sorted(z[0])
	z[1] = sorted(z[1])
	print(max(z[0][-1] - z[0][0], z[1][-1] - z[1][0]))

def __starting_point():
	main()
__starting_point()


pnt = []
n = int(input())
for i in range(n):
	pnt.append(list(map(int, input().split())))
z = []
w = []
for i in pnt:
	z.append(i[0] + i[1])
	w.append(i[0] - i[1])
print(max(max(z) - min(z), max(w) - min(w)))


import sys
input = sys.stdin.readline
n = int(input())
ab = []
A = -1e+20
B = -1e+20
C = 1e+20
D = 1e+20
for i in range(n):
	(x, y) = map(int, input().split())
	A = max(A, x + y)
	B = max(B, x - y)
	C = min(C, x + y)
	D = min(D, x - y)
print(max(A - C, B - D))


n = int(input())
(plus, minus) = ([], [])
for i in range(n):
	(a, b) = map(int, input().split())
	plus.append(a + b)
	minus.append(a - b)
plus.sort()
minus.sort()
print(max(plus[-1] - plus[0], minus[-1] - minus[0]))


N = int(input())
(a, b, c, d) = (0, 10000000000.0, -10000000000.0, 10000000000.0)
for i in range(N):
	(A, B) = input().split()
	A = int(A)
	B = int(B)
	a = max(a, A + B)
	b = min(b, A + B)
	c = max(c, A - B)
	d = min(d, A - B)
print(max(abs(a - b), abs(c - d)))


n = int(input())
xy_array = [list(map(int, input().split())) for _ in range(n)]
th = pow(10, 9)
z_max = -th
z_min = th
w_max = -th
w_min = th
for (x, y) in xy_array:
	z_max = max(x + y, z_max)
	z_min = min(x + y, z_min)
	w_max = max(x - y, w_max)
	w_min = min(x - y, w_min)
ans = max(z_max - z_min, w_max - w_min)
print(ans)


def main():
	n = int(input())
	(X, Y) = ([], [])
	for _ in range(n):
		(x, y) = list(map(int, input().split()))
		X.append(x + y)
		Y.append(x - y)
	X.sort()
	Y.sort()
	print(max(X[-1] - X[0], Y[-1] - Y[0]))

def __starting_point():
	main()
__starting_point()


INF = 2 ** 31
n = int(input())
f = lambda : map(int, input().split())
s = t = INF
S = T = -INF
for _ in range(n):
	(x, y) = f()
	s = min(s, x + y)
	S = max(S, x + y)
	t = min(t, x - y)
	T = max(T, x - y)
print(max(S - s, T - t))


N = int(input())
zls = [0 for _ in range(N)]
wls = [0 for _ in range(N)]
for i in range(N):
	(x, y) = [int(s) for s in input().split()]
	zls[i] = x + y
	wls[i] = x - y
print(max([max(zls) - min(zls), max(wls) - min(wls)]))


n = int(input())
ans = []
ans2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	ans.append(a + b)
	ans2.append(10 ** 9 + 1 - a + b)
print(max(max(ans) - min(ans), max(ans2) - min(ans2)))


n = int(input())
xsum = []
xsub = []
for i in range(n):
	(a, b) = map(int, input().split())
	xsum.append(a + b)
	xsub.append(a - b)
result = max(max(xsum) - min(xsum), max(xsub) - min(xsub))
print(result)


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy1 = [x + y for (x, y) in xy]
xy2 = [-x + y for (x, y) in xy]
ans1 = max(xy1) - min(xy1)
ans2 = max(xy2) - min(xy2)
print(max(ans1, ans2))


N = int(input())
xx = []
yy = []
for i in range(N):
	(x, y) = map(int, input().split())
	xx.append(x + y)
	yy.append(x - y)
xx.sort()
yy.sort()
print(max(xx[-1] - xx[0], yy[-1] - yy[0]))


n = int(input())
l = []
ar = []
br = []
for i in range(n):
	l.append(list(map(int, input().split())))
	ar.append(l[-1][0] + l[-1][1])
	br.append(l[-1][0] - l[-1][1])
ar.sort()
br.sort()
an = max(abs(ar[-1] - ar[0]), abs(br[-1] - br[0]))
print(an)


n = int(input())
(a, b, c, d) = (2 * 10 ** 9, 0, 10 ** 9, -10 ** 9)
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a = a if a < x + y else x + y
	b = b if b > x + y else x + y
	c = c if c < y - x else y - x
	d = d if d > y - x else y - x
print(b - a if b - a > d - c else d - c)


n = int(input())
plus = []
minus = []
for i in range(n):
	(x, y) = map(int, input().split())
	plus.append(x + y)
	minus.append(x - y)
print(max(max(plus) - min(plus), max(minus) - min(minus)))


import numpy as np
N = int(input())
x = []
y = []
xy1 = []
xy2 = []
for i in range(N):
	(a, b) = (int(t) for t in input().split())
	x.append(a)
	y.append(b)
	xy1.append(a + b)
	xy2.append(a - b)
max1 = max(xy1) - min(xy1)
max2 = max(xy2) - min(xy2)
print(max((max1, max2)))


n = int(input())
u = []
v = []
for i in range(n):
	(x, y) = map(int, input().split())
	u.append(x + y)
	v.append(x - y)
u.sort()
v.sort()
print(max(u[-1] - u[0], v[-1] - v[0]))


def solve():
	n = int(input())
	z = [0 for _ in range(n)]
	w = [0 for _ in range(n)]
	for i in range(n):
		(a, b) = list(map(int, input().split()))
		z[i] = a + b
		w[i] = a - b
	print(max(max(z) - min(z), max(w) - min(w)))

def __starting_point():
	solve()
__starting_point()


n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [u[i][0] - u[i][1] for i in range(n)]
d = [max(z) - min(z), max(w) - min(w)]
print(max(d))


n = int(input())
d1 = []
d2 = []
for _ in range(n):
	(a, b) = map(int, input().split())
	d1.append(a + b)
	d2.append(a - b)
print(max(max(d1) - min(d1), max(d2) - min(d2)))


n = int(input())
pointx = []
pointy = []
for i in range(n):
	(x, y) = map(int, input().split())
	pointx.append(x - y)
	pointy.append(x + y)
print(max(max(pointx) - min(pointx), max(pointy) - min(pointy)))


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x + y)
	b.append(x - y)
a = sorted(a)
b = sorted(b)
ans = max(a[-1] - a[0], b[-1] - b[0])
print(ans)


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
w = [xy[i][0] - xy[i][1] for i in range(n)]
z = [xy[i][0] + xy[i][1] for i in range(n)]
print(max(max(w) - min(w), max(z) - min(z)))


N = int(input())
z = []
w = []
for i in range(N):
	(x, y) = map(int, input().split())
	z.append(x + y)
	w.append(x - y)
z.sort()
w.sort()
print(max(z[-1] - z[0], w[-1] - w[0]))


N = int(input())
A = []
B = []
for i in range(N):
	(x, y) = map(int, input().split())
	a = x + y
	A.append(a)
	b = x - y
	B.append(b)
A.sort()
B.sort()
Max_A = A[-1] - A[0]
Max_B = B[-1] - B[0]
ans = max(Max_A, Max_B)
print(ans)


(n, *z) = map(int, open(0).read().split())
(a, b) = ([], [])
for (x, y) in zip(*[iter(z)] * 2):
	a += (x + y,)
	b += (x - y,)
print(max(abs(max(a) - min(a)), abs(max(b) - min(b))))


N = int(input())
A = []
B = []
for i in range(N):
	(x, y) = map(int, input().split())
	A.append(x + y)
	B.append(x - y)
a = max(A)
b = min(A)
c = max(B)
d = min(B)
ans = max(a - b, c - d)
print(ans)