You are given N points on a 2D plane, each located at (x_i, y_i). Find the maximum Manhattan distance between two distinct points. Manhattan distance is defined as |x_i-x_j| + |y_i-y_j|. Constraints: 2 ≤ N ≤ 2 × 10^5, 1 ≤ x_i, y_i ≤ 10^9. Input format: N, followed by x and y coordinates for each point. Output the maximum distance. Example input: 3, 1 1, 2 4, 3 2. Example output: 4.

# Buggy version:
n = int(input())

points = []

for i in range(n) :
    point = list(map(int, input(" ")))
    points.append(point)

z = []
w = []

for i in range(len(points)) :
    z.append(points[i][0] + points[i][1])

for i in range(len(points)) :
    w.append(points[i][0] - points[i][1])

max_z = max(z) - min(z)
max_w = max(w) - min(w)

if max_z > max_w :
    print(max_z)
else :
    print(max_w)

# Fixed version:
n = int(input())

points = []

for i in range(n) :
    point = list(map(int, input().split(" ")))
    points.append(point)

z = []
w = []

for i in range(len(points)) :
    z.append(points[i][0] + points[i][1])

for i in range(len(points)) :
    w.append(points[i][0] - points[i][1])

max_z = max(z) - min(z)
max_w = max(w) - min(w)

if max_z > max_w :
    print(max_z)
else :
    print(max_w)

# Buggy version:
def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x0, y0 = xy[i]
        x2[i] = x0 - y0
        y2[i] = x0 + y0
    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] = map(int, input().split())
manhattan(n, x, y)


# Fixed version:
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] = map(int, input().split())
manhattan(n, x, y)

# Buggy version:
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)
print(abs(max(max(a),max(b)))-abs(min(min(a),min(b))))

# Fixed version:
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)))

# Buggy version:
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

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

# Fixed version:
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

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

# Buggy version:
import math
N = int(input())

s1 = []
s2 = []
#visited
for i in range(N):
    x, y = map(int, input().split())
    d0 = x + y
    d1 = x - y
    if d0 in s1 and d1 in s2 and s1.index(d0) == s2.index(d1):
        continue
    s1.append(d0)
    s2.append(d1)


ans = 0

if len(s1) > 1 and len(s2) > 1:
    s1s = sorted(s1)
    s2s = sorted(s2)

    ans = max(s1s[0] - s1s[-1], (s2s[0] - s2s[-1])
              , (s1s[0] - s2s[0]), (s1s[-1] - s2s[-1]))

print(int(ans))




# Fixed version:
import math
N = int(input())

s1 = []
s2 = []
#visited
for i in range(N):
    x, y = map(int, input().split())
    d0 = x + y
    d1 = x - y
    #if d0 in s1 and d1 in s2 and s1.index(d0) == s2.index(d1):
    #    continue
    s1.append(d0)
    s2.append(d1)


ans = 0

if len(s1) > 1 and len(s2) > 1:
    s1s = sorted(s1)
    s2s = sorted(s2)

    ans = max(s1s[0] - s1s[-1], s2s[0] - s2s[-1]
              , s1s[-1] - s1s[0], s2s[-1] - s2s[0])

print(int(ans))

# Buggy version:
def main():
  n = int(input())
  a_li , b_li = [] , []
  for _ in range(n):
    x , y = int(input())
    a_li.append(x + y)
    b_li.append(x - y)
    print(max(max(a_li) - min(a_li), max(b_li) - min(b_li)))

if __name__ == "__main__":
  main()

# Fixed version:
def main():
  n = int(input())
  a_li , b_li = [] , []
  for _ in range(n):
    x , y = map(int,input().split())
    a_li.append(x + y)
    b_li.append(x - y)
  print(max(max(a_li) - min(a_li), max(b_li) - min(b_li)))
 
if __name__ == "__main__":
  main()

# Buggy version:
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
cheby = []
for i in range(n):
    l = [xy[i][0]-xy[i][1],xy[i][0]+xy[i][1]]
    cheby.append(l)

xmax = 0
xmin = 10**10
ymax = 0
ymin = 10**10
for i in range(n):
    if cheby[i][0] > xmax :
        xmax = cheby[i][0]
        xa = i
    if cheby[i][0] < xmin :
        xmin = cheby[i][0]
        xi = i
    if cheby[i][1] > ymax :
        ymax = cheby[i][1]
        ya = i
    if cheby[i][1] < ymin :
        ymin = cheby[i][1]
        yi = i

if abs(xmax-xmin) >= abs(ymax-ymin):
    print(abs(xy[xa][0]-xy[xi][0])+abs(xy[xa][1]-xy[xi][1]))
else :
    print(abs(xy[ya][0]-xy[yi][0])+abs(xy[ya][1]-xy[yi][1]))


# Fixed version:
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
cheby = []
for i in range(n):
    l = [xy[i][0]-xy[i][1],xy[i][0]+xy[i][1]]
    cheby.append(l)

xmax = -10**10
xmin = 10**10
ymax = -10**10
ymin = 10**10
for i in range(n):
    if cheby[i][0] > xmax :
        xmax = cheby[i][0]
        xa = i
    if cheby[i][0] < xmin :
        xmin = cheby[i][0]
        xi = i
    if cheby[i][1] > ymax :
        ymax = cheby[i][1]
        ya = i
    if cheby[i][1] < ymin :
        ymin = cheby[i][1]
        yi = i

if abs(xmax-xmin) > abs(ymax-ymin):
    print(abs(xy[xa][0]-xy[xi][0])+abs(xy[xa][1]-xy[xi][1]))
else :
    print(abs(xy[ya][0]-xy[yi][0])+abs(xy[ya][1]-xy[yi][1]))

# Buggy version:
n = int(input())
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]))

# Fixed version:
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]))

# Buggy version:
# Fast IO (be careful about bytestring, not on interactive)

import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

N = int(input())

sumList = []
subList = []

for _ in range(N):
    x,y = map(int,input().split())
    sumList.append(x + y)
    subList.append(x - y)

print(max(max(sumList),max(subList)))

# Fixed version:
# Fast IO (be careful about bytestring, not on interactive)

import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

N = int(input())

sumList = []
subList = []

for _ in range(N):
    x,y = map(int,input().split())
    sumList.append(x + y)
    subList.append(x - y)

print(max(max(sumList) - min(sumList),max(subList) - min(subList)))

# Buggy version:
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 = [w[i][0] - w[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))
	


# Fixed version:
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))

# Buggy version:
n = int(input())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))
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]]))

# Fixed version:
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]]))

# Buggy version:
n=int(input())
xbox=[]
ybox=[]
for i in range(n):
    x,y = map(int,input().split())
    xbox.append(x)
    ybox.append(y)
xmax=max(xbox)
xmin = min(xbox)
ymax=max(ybox)
ymin=min(ybox)
box1=[]
box2=[]
box3=[]
box4=[]
for i in range(n):
    box1.append(xmax+ymax-xbox[i]-ybox[i])
    box2.append(-xmin + ymax + xbox[i] - ybox[i])
    box2.append(xmax - ymax - xbox[i] + ybox[i])
    box2.append(-xmax - ymax + xbox[i] + ybox[i])
print(max([max(box1)-min(box1),max(box2)-min(box2),max(box3)-min(box3),max(box4)-min(box4)]))


# Fixed version:
n=int(input())
xbox=[]
ybox=[]
for i in range(n):
    x,y = map(int,input().split())
    xbox.append(x)
    ybox.append(y)
xmax=max(xbox)
xmin = min(xbox)
ymax=max(ybox)
ymin=min(ybox)
box1=[]
box2=[]
box3=[]
box4=[]
for i in range(n):
    box1.append(xmax+ymax-xbox[i]-ybox[i])
    box2.append(-xmin + ymax + xbox[i] - ybox[i])
    box3.append(xmax - ymax - xbox[i] + ybox[i])
    box4.append(-xmax - ymax + xbox[i] + ybox[i])
print(max([max(box1)-min(box1),max(box2)-min(box2),max(box3)-min(box3),max(box4)-min(box4)]))

# Buggy version:
n = int(input())
xy = []
for _ in range(n):
    xy.append(list(map(int,input().split())))
a,b=xy[0]
m1=a+b
p1=xy[0]
m2=a-b
p2=xy[0]
p3=xy[0]
p4=xy[0]
m3=-a-b
m4=-a+b

for x,y in xy:
    if x+y > m1:
        p1 = [x,y]
if x-y > m2:
        p2 = [x,y]
if -x-y > m3:
        p3 = [x,y]
if -x+y > m4:
        p4 = [x,y]
m = 0
for x0,y0 in [p1,p2,p3,p4]:
    for x1,y1 in [p1,p2,p3,p4]:
        dis=abs(x0-x1) + abs(y0-y1)
        if dis > m:
            m = dis
print(m)

# Fixed version:
n = int(input())
xy = []
for _ in range(n):
    xy.append(list(map(int,input().split())))
a,b=xy[0]
m1=a+b
p1=xy[0]
m2=a-b
p2=xy[0]
p3=xy[0]
p4=xy[0]
m3=-a-b
m4=-a+b

for x,y in xy:
    if x+y > m1:
        m1=x+y
        p1 = [x,y]
    if x-y > m2:
        m2=x-y
        p2 = [x,y]
    if -x-y > m3:
        m3 = -x-y
        p3 = [x,y]
    if -x+y > m4:
        m4 = -x+y
        p4 = [x,y]
m = 0
for x0,y0 in [p1,p2,p3,p4]:
    for x1,y1 in [p1,p2,p3,p4]:
        dis=abs(x0-x1) + abs(y0-y1)
        if dis > m:
            m = dis
print(m)

# Buggy version:
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))))

# Fixed version:
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))))

# Buggy version:
import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

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

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    x, y = i2(N)

    Mw = max(x[i]+y[i] for i in range(N))
    mw = min(x[i]+y[i] for i in range(N))
    Mz = max(abs(a[i]-y[i]) for i in range(N))
    mz = min(abs(x[i]-y[i]) for i in range(N))

    print(max(Mz-mz, Mw-mw))
    


if __name__ == '__main__':
    main()


# Fixed version:
import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

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

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    x, y = i2(N)

    Mw = max(x[i]+y[i] for i in range(N))
    mw = min(x[i]+y[i] for i in range(N))
    Mz = max(x[i]-y[i] for i in range(N))
    mz = min(x[i]-y[i] for i in range(N))

    print(max(Mz-mz, Mw-mw))
    


if __name__ == '__main__':
    main()

# Buggy version:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N = I()
A,B = [],[]  # x+y,x-y たちのリスト
for i in range(N):
    x,y = MI()
    A.append(x+y)
    B.append(x-y)

print(max(A)-min(A),max(B)-min(B))


# Fixed version:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N = I()
A,B = [],[]  # x+y,x-y たちのリスト
for i in range(N):
    x,y = MI()
    A.append(x+y)
    B.append(x-y)

print(max(max(A)-min(A),max(B)-min(B)))

# Buggy version:
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())
X = []
Y = []
for i in range(N):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)

ans1 = []
ans2 = []
for i in range(N):
    ans1.append(X[i] + Y[i])
    ans2.append(Y[i] - X[i])
ans1.sort()
ans2.sort()

a = ans1[-1] - ans1[1]
b = ans2[-1] - ans2[1]

print(max(a,b))

# Fixed version:
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())
X = []
Y = []
for i in range(N):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)

ans1 = []
ans2 = []
for i in range(N):
    ans1.append(X[i] + Y[i])
    ans2.append(Y[i] - X[i])
ans1.sort()
ans2.sort()

a = ans1[-1] - ans1[0]
b = ans2[-1] - ans2[0]

print(max(a,b))

# Buggy version:
n=int(input())

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

def maxAbsValExpr(arr1, arr2):
    minX, maxX = min(arr1), max(arr1)
    minY, maxY = min(arr2), max(arr2)
    
    ans = 0
    # For all four corners, calculate the max distance differences
    for point in [(minX, minY), (maxX, minY), (minX, maxY), (maxX, maxY)]:
        minD = float('inf')
        maxD = float('-inf')
        for i in range(0, len(arr1)):
            distance = abs(arr1[i]-point[0]) + abs(arr2[i]-point[1]) + i
            minD = min(minD, distance)
            maxD = max(maxD, distance)
            ans = max(ans, maxD - minD)
    return ans


print(maxAbsValExpr(x, y))



# Fixed version:
n=int(input())

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

def maxAbsValExpr(arr1, arr2):
    minX, maxX = min(arr1), max(arr1)
    minY, maxY = min(arr2), max(arr2)
    
    ans = 0
    # For all four corners, calculate the max distance differences
    for point in [(minX, minY), (maxX, minY), (minX, maxY), (maxX, maxY)]:
        minD = float('inf')
        maxD = float('-inf')
        for i in range(0, len(arr1)):
            distance = abs(arr1[i]-point[0]) + abs(arr2[i]-point[1]) 
            minD = min(minD, distance)
            maxD = max(maxD, distance)
            ans = max(ans, maxD - minD)
    return ans


print(maxAbsValExpr(x, y))

# Buggy version:
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]+f1[0], f0[0]+f1[-1]))

# Fixed version:
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

f0 = [x - y for x, y in xy]
f1 = [x + y for x, y in xy]

f0.sort()
f1.sort()

ans = max((f0[-1] - f0[0]), (f1[-1] - f1[0]))
print(ans)

# Buggy version:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y])

data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)

# Fixed version:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
data = []
for i in range(n):
	x,y = readInts()
	data.append([x+y,x,y,x-y])
ans = 0
data.sort(key=lambda x:x[0])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[1])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[2])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
data.sort(key=lambda x:x[3])
ans = max(ans,abs(data[-1][1]-data[0][1])+abs(data[-1][2]-data[0][2]))
print(ans)

# Buggy version:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    x, y = MI()
    x1 = x
    x2 = x
    x3 = x
    x4 = x
    y1 = y
    y2 = y
    y3 = y
    y4 = y
    for _ in range(n-1):
        x, y = MI()
        if x+y > x1+y1:
            x1 = x
            y1 = y
        if -x+y > -x2+y2:
            x2 = x
            y2 = y
        if -x-y > -x3-y3:
            x3 = x
            y3 = y
        if x-y > x4-y4:
            x4 = x
            y4 = y
        temp = [abs(x1-x2)+abs(y1-y2), abs(x1-x3)+abs(y1-y3), abs(x1-x4)+abs(y1-y4), abs(x2-x3)+abs(y2-y3), abs(x2-x4)+abs(y2-y4), abs(x3-x4)+abs(y3-y4)]
        ans = max(temp)
        print(ans)

if __name__ == '__main__':
    main()

# Fixed version:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    x, y = MI()
    x1 = x
    x2 = x
    x3 = x
    x4 = x
    y1 = y
    y2 = y
    y3 = y
    y4 = y
    for _ in range(n-1):
        x, y = MI()
        if x+y > x1+y1:
            x1 = x
            y1 = y
        if -x+y > -x2+y2:
            x2 = x
            y2 = y
        if -x-y > -x3-y3:
            x3 = x
            y3 = y
        if x-y > x4-y4:
            x4 = x
            y4 = y
    temp = [abs(x1-x2)+abs(y1-y2), abs(x1-x3)+abs(y1-y3), abs(x1-x4)+abs(y1-y4), abs(x2-x3)+abs(y2-y3), abs(x2-x4)+abs(y2-y4), abs(x3-x4)+abs(y3-y4)]
    ans = max(temp)
    print(ans)

if __name__ == '__main__':
    main()

# Buggy version:
N = int(input())
Array1 = []
Array2 = []

for i in range(N):
    next_x, next_y = map(int, input().split())
    s = next_x + next_y
    t = next_x - next_y
    Array1.append(s)
    Array2.append(t)

print(max(max(Array1)-min(Array2),max(Array2)-min(Array1)))

# Fixed version:
N = int(input())
Array1 = []
Array2 = []

for i in range(N):
    next_x, next_y = map(int, input().split())
    s = next_x + next_y
    t = next_x - next_y
    Array1.append(s)
    Array2.append(t)

print(max(max(Array1)-min(Array1),max(Array2)-min(Array2)))

# Buggy version:
n = int(input())
l = []
ll = []
for _ in range(n):
    x, y = map(int, input().split())
    l.append((x+y, x, y))
    ll.append((x-y, x, y))
l.sort()
ll.sort()
ans1 = 0
ans2 = 0

cnt = 0
while True:
    a = l[-cnt]
    b = l[cnt]
    if a[1] >= b[1] and a[2] >= b[2]:
        ans1 = b[0]-a[0]
        break
    if cnt >= n-1:
        break
    cnt += 1

cnt = 0
while True:
    a = l[-cnt]
    b = l[cnt]
    if a[1] >= a[2] and b[2] >= b[1]:
        ans2 = b[0]-a[0]
        break
    if cnt >= n-1:
        break
    cnt += 1

print(max(ans1, ans2))


# Fixed version:
n = int(input())
l = []
ll = []
for _ in range(n):
    x, y = map(int, input().split())
    l.append((x+y, x, y))
    ll.append((x-y, x, y))
l.sort()
ll.sort()
ans1 = 0
ans2 = 0
#print(l)
#print(ll)

cnt = 0
while True:
    a = l[n-1-cnt]
    b = l[cnt]
    #print(a, b)
    if a[1] >= b[1] and a[2] >= b[2]:
        ans1 = abs(b[0]-a[0])
        #print(ans1, a, b)
        break
    if cnt >= n-1:
        break
    cnt += 1

cnt = 0
while True:
    a = ll[n-1-cnt]
    b = ll[cnt]
    if a[1] >= b[1] and b[2] >= a[2]:
        ans2 = abs(b[0]-a[0])
        #print(ans2, a, b)
        break
    if cnt >= n-1:
        break
    cnt += 1

print(max(ans1, ans2))

# Buggy version:
N = int(input())

Xmax = -2*10**9
Ymax = -2*10**9
Xmin = 2*10**9
Ymin = 2*10**9


for i in range(N):
    x, y = map(int, input().split())
    if (x + y >= Xmax):
        Xmax = x + y
    if (x + y =< Xmin):
        Xmin = x + y
    if (x - y >= Ymax):
        Ymax = x - y
    if (x - y =< Ymin):
        Ymin = x - y

print(max(Xmax - Xmin, Ymax - Ymin))

# Fixed version:
N = int(input())

Xmax = -2*10**9
Ymax = -2*10**9
Xmin = 2*10**9
Ymin = 2*10**9


for i in range(N):
    x, y = map(int, input().split())
    if (x + y >= Xmax):
        Xmax = x + y
    if (x + y <= Xmin):
        Xmin = x + y
    if (x - y >= Ymax):
        Ymax = x - y
    if (x - y <= Ymin):
        Ymin = x - y

print(max(Xmax - Xmin, Ymax - Ymin))

# Buggy version:
n = int(input())
x_list = []
y_list = []
for _ in range(n):
    x, y = map(int, input().split())
    x_list.append(x)
    y_list.append(y)
x_list.sort()
y_list.sort()
ans = x_list[-1] - x_list[0] + y_list[-1] - y_list[0]
print(ans)

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

# Buggy version:
import numpy as np

n = int(input())

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

x = np.array(x)
y = np.array(y)

xy0 = x + y
xy1 = x - y
print(int(max(max(xy0)-min(xy1),max(xy1)-min(xy0))/2))

# Fixed version:
import numpy as np

n = int(input())

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

x = np.array(x)
y = np.array(y)

xy0 = x + y
xy1 = x - y

print(max(max(xy0)-min(xy0),max(xy1)-min(xy1)))

# Buggy version:
N = int(input())
xy = [list(map(int,input().split())) for _ in range(N)]
ma = 0
mi = float('inf')
for x,y in xy:
  ma = max(ma,abs(x-y))
  mi = min(mi,abs(x-y))
ans = ma - mi

ma = 0
mi = float('inf')
for x,y in xy:
  ma = max(ma,x+y)
  mi = min(mi,x+y)

print(ans)

# Fixed version:
N = int(input())
xy = [list(map(int,input().split())) for _ in range(N)]
ma = -float('inf')
mi = float('inf')
for x,y in xy:
  ma = max(ma,x-y)
  mi = min(mi,x-y)
ans = ma - mi

ma = -float('inf')
mi = float('inf')
for x,y in xy:
  ma = max(ma,x+y)
  mi = min(mi,x+y)
  
ans = max(ans, ma - mi)
print(ans)

# Buggy version:
def dist(a, b):
    return abs(a[0] - b[0]) + abs(a[1] - b[1])

def resolve():
    import sys
    input = sys.stdin.readline

    n = int(input().rstrip())
    ru = None
    rd = None
    lu = None
    ld = None

    for i in range(n):
        row = [int(x) for x in input().rstrip().split(" ")]
        if i == 0:
            ru = row
            rd = row
            lu = row
            ld = row
            continue

        if ru[0] + ru[1] < row[0] + row[1]:
            ru = row
        if rd[0] - rd[1] < row[0] - row[1]:
            rd = row
        if -lu[0] + lu[1] < -row[0] + row[1]:
            lu = row
        if -ld[0] - ld[1] < -row[0] - row[1]:
            ld = row

    ans = 0
    points = [ru, rd, lu, ld]
    for i in range(4):
        for j in range(i+1, 4):
            tmp = dist(points[i], points[j])
            if ans < tmp:
                ans = tmp

    print(ans)

# Fixed version:

def dist(a, b):
    return abs(a[0] - b[0]) + abs(a[1] - b[1])

def resolve():
    import sys
    input = sys.stdin.readline

    n = int(input().rstrip())
    ru = None
    rd = None
    lu = None
    ld = None

    for i in range(n):
        row = [int(x) for x in input().rstrip().split(" ")]
        if i == 0:
            ru = row
            rd = row
            lu = row
            ld = row
            continue

        if ru[0] + ru[1] < row[0] + row[1]:
            ru = row
        if rd[0] - rd[1] < row[0] - row[1]:
            rd = row
        if -lu[0] + lu[1] < -row[0] + row[1]:
            lu = row
        if -ld[0] - ld[1] < -row[0] - row[1]:
            ld = row

    ans = 0
    points = [ru, rd, lu, ld]
    for i in range(4):
        for j in range(i+1, 4):
            tmp = dist(points[i], points[j])
            if ans < tmp:
                ans = tmp

    print(ans)


if __name__ == "__main__":
    resolve()

# Buggy version:
from math import *
import fractions
import sys
import collections
import itertools
import pprint
from collections import deque
from heapq import *
import copy
N=int(input())
points=[list(map(int,input().split())) for _ in range(N)]


chebmax0=-float("inf")
chebmin0=float("inf")
chebmax1=-float("inf")
chebmin1=float("inf")

#chebmax0→x-yのmax
for l in points:
    chebmax0=max(chebmax0,l[0]-l[1])
for l in points:
    chebmin0=min(chebmax0,l[0]-l[1])
for l in points:
    chebmax1=max(chebmax1,l[0]+l[1])
for l in points:
    chebmin1=min(chebmax1,l[0]+l[1])
#print(chebmin1,chebmax1,chebmin0,chebmax0)
print(max(chebmax0-chebmin0,chebmax1-chebmin1))

# Fixed version:
from math import *
import fractions
import sys
import collections
import itertools
import pprint
from collections import deque
from heapq import *
import copy
N=int(input())
points=[list(map(int,input().split())) for _ in range(N)]


chebmax0=-float("inf")
chebmin0=float("inf")
chebmax1=-float("inf")
chebmin1=float("inf")

#chebmax0→x-yのmax
for l in points:
    chebmax0=max(chebmax0,l[0]-l[1])
for l in points:
    chebmin0=min(chebmin0,l[0]-l[1])
for l in points:
    chebmax1=max(chebmax1,l[0]+l[1])
for l in points:
    chebmin1=min(chebmin1,l[0]+l[1])
#print(chebmin1,chebmax1,chebmin0,chebmax0)
print(max(chebmax0-chebmin0,chebmax1-chebmin1))

# Buggy version:
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(d)
print(max(d[0]-d[1], d[2]-d[3]))

# Fixed version:
N = int(input())
d = [[], []]
for i in range(N):
    x, y = map(int, input().split())
    d[0].append(x-y)
    d[1].append(x+y)

ans = 0
for i in range(2):
    ans = max(ans, max(d[i])-min(d[i]))
print(ans)

# Buggy version:
n = int(input())
maxx, minx, maxy, miny = -1**10, 1**10, -1**10, 1**10
for _ in range(n):
	x, y = map(int, input().split())
	x, y = x+y, x-y
	maxx = max(maxx, x)
	minx = min(minx, x)
	maxy = max(maxy, y)
	miny = min(miny, y)
print(max(maxx - minx, maxy - miny))


# Fixed version:
n=int(input())

minx=10**10
maxx=-10**10
miny=10**10
maxy=-10**10

for _ in range(n):
    x,y=map(int,input().split())

    maxx=max(maxx,x+y)
    minx=min(minx,x+y)
    maxy=max(maxy,x-y)
    miny=min(miny,x-y)

print(max(maxx-minx,maxy-miny))

# Buggy version:
import sys

def f(x,y):
    return x-y.x+y

def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    x = [0]*n
    y = [0]*n
    for i in range(n):
        x[i],y[i] = map(int,input().split())
    f0 = [0]*n
    f1 = [0]*n
    for i in range(n):
        f0[i],fi[i] = f(x[i],y[i])
    print(max(max(f0)-minf(0),max(f1)-minf(1)))

if __name__ = "__main__":
    main()

# Fixed version:
import sys


def f(x, y):
    return x - y, x + y


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    x = [0] * n
    y = [0] * n
    for i in range(n):
        x[i], y[i] = map(int, input().split())
    f0 = [0] * n
    f1 = [0] * n
    for i in range(n):
        f0[i], f1[i] = f(x[i], y[i])
    print(max(max(f0) - min(f0), max(f1) - min(f1)))


if __name__ == "__main__":
    main()