import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 n = ii() XY = [li() + [i] for i in range(n)] mini = [inf] * n XY.sort(key = lambda x: (x[0], x[1])) for i in range(n): x1, y1, ind1 = XY[i] if i > 0: x2, y2, _ = XY[i - 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) if i < n - 1: x2, y2, _ = XY[i + 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) XY.sort(key = lambda x: (x[1], x[0])) for i in range(n): x1, y1, ind1 = XY[i] if i > 0: x2, y2, _ = XY[i - 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) if i < n - 1: x2, y2, _ = XY[i + 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) XY.sort(key = lambda x: (x[0] + x[1])) for i in range(n): x1, y1, ind1 = XY[i] if i > 0: x2, y2, _ = XY[i - 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) if i < n - 1: x2, y2, _ = XY[i + 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) XY.sort(key = lambda x: (x[0] - x[1])) for i in range(n): x1, y1, ind1 = XY[i] if i > 0: x2, y2, _ = XY[i - 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) if i < n - 1: x2, y2, _ = XY[i + 1] mini[ind1] = min(mini[ind1], abs(x1 - x2) + abs(y1 - y2)) xmax = -inf xmin = inf ymax = -inf ymin = inf for i in range(n): x, y, ind = XY[i] XY[i] = [x + y, x - y, ind] xmax = max(xmax, x + y) xmin = min(xmin, x + y) ymax = max(ymax, x - y) ymin = min(ymin, x - y) maxi = [0] * n for i in range(n): x, y, ind = XY[i] maxi[ind] = max(xmax - x, x - xmin, ymax - y, y - ymin) ans = inf for i in range(n): ans = min(ans, maxi[i] - mini[i]) print(ans)