peterverebics/CodeNet_Python_118 huggingface dataset:
import itertools
n = int(input())
nums = ["0", "9"]
  
if n == 1:
  print(0)
elif n == 2:
  print(2)
else:
  for i in range(n-len(nums)):
    nums.append("x")
  count = 0
  for v in itertools.permutations(nums, len(nums)):
    check = list(v)
    count += 9**check.count("x")
  print(count%(10**9+7))
mod=1000000007
n=int(input())

def pow_by_iter(a, x, p):
    acc = a
    for i in range(1, x):
        acc = (acc * a) % p
    return acc

if n>2:
  print(((n%mod)*((n-1)%mod)*(10**(n-2)))%mod)
else:
  print(n*(n-1))
n = int(input())
ans_max = 1
for i in range(n):
    ans_max = ans_max * 10 % 1000000007


ans_mid = 1
for i in range(n):
    ans_mid = ans_mid * 9 % 1000000007
ans_mid = ans_mid * 2 % 1000000007

ans_min = 1
for i in range(n):
    ans_min = ans_min * 8 % 1000000007
print(ans_max - (ans_mid - ans_min))
N = int(input())
mod = 10**9 + 7
ans = pow(10,N,mod)
ans -= pow(9,N,mod)
ans -= pow(9,N,mod)
ans += pow(8,N,mod)
print(ans)
import math
def con(n):
    return math.factorial(n) // (math.factorial(n-2)*2)

n = int(input())
if n ==1:
    print("0")
elif n == 2:
    print('2')
elif n>2:
    a=con(n)
    x=2*pow(8,(n-2))*a
    y=pow(2, (n-2))*a
    z=x+y
    b=pow(10,9)+7
    ans = z%b
    print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    mod = pow(10,9) + 7
    ans = pow(10,n,mod)
    ans -= pow(9,n,mod)*2
    ans += pow(8,n,mod)

    print(ans)

if __name__ == '__main__':
    main()
import math

mod=10**9+7

N=int(input())

if(N==1):
    print(0)
else:

    if(N-2>10):
        a=10**(N-2)%mod
        b=math.factorial(N) //  math.factorial(N-2)
        c1=b*a%mod
        print(c1)
    else:
        a=10**(N-2)
        b=math.factorial(N) //  math.factorial(N-2)
        c=b*a
        print(c)
mod=1000000007
n=int(input())

def pow_by_iter(a, x, p):
    acc = a
    for i in range(1, x):
        acc = (acc * a) % p
    return acc

print(pow_by_iter(10, n, mod)+pow_by_iter(8, n, mod)-pow_by_iter(9, n, mod)-pow_by_iter(9, n, mod))
def modpow(a, n, mod):
    res = 1
    while n:
        if n % 2:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


MOD = 1000000007

n = int(input())
ans = modpow(10, n, MOD) - 2 * modpow(9, n, MOD) + modpow(8, n, MOD)
print(ans)
N = int(input())
MOD = 10 ** 9 + 7
if N == 1:
  print(0)
  exit()
a = pow(10, N, MOD)
b = pow(9, N, MOD)
c = pow(8, N, MOD)
ans = a - (2 * b) + c
if ans < 0:
  ans += MOD
print(ans)
def modpow(a,n,mod):
    res = 1
    while n > 0:
        if n&1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res



N = int(input())
mod = 10**9+7
if N==1:
    print(0)
else:
    temp =modpow(10,N-2,mod)
    print (temp*N*(N-1)%mod)
p = 10 ** 9 + 7
N = int(input())
fact = [1, 1]  
factinv = [1, 1] 
inv = [0, 1] 

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

n = N

b = 0
for a in range (1,N):
  b = b + cmb(n, a, p)
print(b%p)
n=int(input())
if n==1:
  print(0)
else:
  print((10**n-(8*9**(n-1))-2*(9**(n-1)))%(10**9+7))
#print(8*10**(n-1))
#print(2*(9**(n-1)))
n = int(input())
p = 10 ** 9 + 7

def pow(a):
  ans  = 1
  for i in range(n):
    ans = (ans * a) % p
  return ans
x = pow(10) - pow(9) * 2 + pow(8)

print(x)
mod = 1000000007
def f(a, b):
  ans = 1
  while b:
    ans = ans * a % mod
    b >>= 1
    a = a * a % mod
  return ans
n=int(input())
print(((f(10,n)-2*f(9,n)+f(8,n))%mod+mod)%mod)
mod = 7 + 10e9
n = int(input())

if n == 1:
  print(0)
elif n == 2:
  print(2)
else:
  ans = pow(10,n-2)
  print(ans%n)
N=2

if N<2:
	print(0)
elif N==2:
	print(2)
else:
	without=10**(N-2)
	each=N*(N-1)
	final=without*each

	considered=final%(10**9+7)

	print(considered)
n = int(input())
print(10**n-2*9**n+8**n)
N = int(input().rstrip())
answer = 0

for i in range(2, N + 1):
    a = N - i
    answer += i * (i - 1) * ((10 ** a) % 1000000007)* (8 ** (i - 2) % 1000000007)
#式が間違っている
print(answer % 1000000007)
N = int(input())

mod = 10**9+7
def p(a,n):
    ans  = 1
    for i in range (n):
        ans = ans * a % mod
    return ans

print(p(10,N)+p(8,N) - 2* p(9,N))
import math

n = int(input())

mod = 10**9 + 7
kaijou = math.factorial(n)
tmp = 10**(n-2)

if n == 1:
    print('0')
elif n == 2:
    print('2')
else:
    ans = kaijou * tmp % mod
    print(ans)
N = int(input())
p = N*(N-1) #0,9の並べ方総数
a = p*(10**(N-2))
b = 10**9 + 7
ans = a % b
print(ans)
N=int(input())

print(10**N-2*9**N+8**N)
N = int(input())
MOD = 10 ** 9 + 7
if N == 1:
  print(0)
  exit()
a = 1
b = 1
c = 1
for i in range(N):
  a = a * 10 % MOD
  b = b * 9 % MOD
  c = c * 8 % MOD
ans = a - 2 * b + c
if ans < 0:
  ans += MOD
print(ans)
n = int(input())

mod = 10 ** 9 + 7

print((10 ** n - 2 * (9 ** n) - 8 ** n) % mod)
N = int(input())

mod = 10 ** 9 + 7
nn = 10 ** N % mod
nm = (9 ** N) % mod + (9 ** N) % mod - (8 ** N) % mod

print(nn - nm)
n = int(input())
mod = 10 ** 9 + 7

print((10 ** n) % mod - (9 ** n) % mod * 2 + 8 ** n % mod)
# -*- coding: utf-8 -*-
 
# a, b, c, d = map(int,input().split())

n = int(input())

ret = ((8 ** (n - 2)) * 2) * ((n * (n - 1)) // 2)

print(ret % ((10 ** 9) + 7))
N = int(input())
mod = 1000000007

ans = N * (N-1) * (10**(N-2))
if ans <= 0:
    ans = 0
if N == 2:
    ans = 2

print(ans % mod )
n = int(input())

print(((10**n)%1000000007)-((9**n)%1000000007)-((9**n)%1000000007)+((8**n)%1000000007))
N = int(input())

Num = N * (N-1) * 10 **(N-2)
Answer = Num %(1000000007)
print(Answer)
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 21:20:10 2020

@author: naoki
"""

N = int(input())

if N>=2:
    print(abs(10**N%(10**9+7) - ((9**N *2)%(10**9+7) - (8**N)%(10**9+7))))
else: 
    print(0)
n = int(input())
mod = 10**9 + 7
print(pow(10, n, mod) - 2*pow(9, n, mod) - pow(9, n, mod))
n = int(input())

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

x = p(10, n) - 2*p(9, n) + p(8, n)
if x < 0:
    x += 10 ** 9 + 7
print(x)
import math

N=int(input())

if(N==1):
    print(0)
else:
    a=10**(N-2)
    b=math.factorial(N)*2 // (math.factorial(2) * math.factorial(N-2))
    c=b*a
    if(c>10**9+7):
        c1=c%10**9+7
        print(c1)
    else:
        print(c)
N = input()
N = int(N)

if N == 0 or N == 1:
  print(0)
else:
  print(((10 ** (N-2)) * (N * (N-1)))  % (10 ** 9 + 7))
n = int(input())

num1 = 10**n % (10**9 + 7)
num2 = 9**n % (10**9 + 7)
num3 = 8**n % (10**9 + 7)

print(num1 - num2 * 2 + num3)
#C - Ubiquity
import math
N = int(input())
a = 10**9+7

ans = (10**N)-9**N - 8**N

# def combinations_count(n, r):
#     return math.factorial(n)%a // (math.factorial(n - r)%a * math.factorial(r))%a
#
# ans =(10**(N-2))%a*(combinations_count(N, 2)*2)%a-combinations_count(N, 2)%a
print(ans%a)
N = int(input())
mod = 10**9+7
print(10**N%mod-(9**N%mod+9**N%mod-8**N%mod))
n=int(input())
y=(2**n)-2
x=y*9**(y-2)%(10**9+7)
if x<10**10:print(x)
else:print('ERROR')
N = int(input())
MOD = 10 ** 9 + 7
if N == 1:
  print(0)
  exit()
a = 1
b = 1
c = 1
for i in range(N):
  a = a * 10 % MOD
  b = b * 9 % MOD
  c = c * 8 % MOD
ans = a - (2 * b) + c
if ans < 0:
  ans += MOD
print(ans)
n = int(input())
mod = 10 ** 9 + 7
ans = 10 ** n
print(max(0, ans - 10 * (8 ** (n - 1)) % mod - (9 ** (n - 1) * 2) % mod ) % mod)
N=int(input())
if N==1 or N==0:
  print(0)
  exit()
elif N==2:
  print(2)
  exit()
print(N*(N-1)*10**(N-2)%(10**9+7))
n = int(input())
mod = 10**9+7

def pow(n, num):
  s = num
  for i in range(1,num):
    s = s*num%mod
    return s
print((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)
n = int(input())
b = 0
a = 1

if n == 1:
    print(0)
    exit()
elif n == 2:
    print(2)
    exit()

for i in range(n-1):
    b += a
    a += 1
print((b*20) % (10**9 + 7))
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())
line = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*line)]

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

def g(x,y):
  return x+y
  
print(max(max([f(x[i],y[i]) for i in range(n)])-min([f(x[i],y[i]) for i in range(n)]), max([g(x[i],y[i]) for i in range(n)])-min([g(x[i],y[i]) for i in range(n)])))
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

XY = np.array(read().split(), np.int64)[1:]

X, Y = XY[::2], XY[1::2]

A = X + Y
B = X - Y

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

M1=L1[-1]-L1[0]
M2=L2[-1]-L2[0]
M3=L3[-1]-L3[0]
print(max(M1,M2,M3))
N = int(input())

xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

x_c = [x + y for (x, y) in zip(x, y)]
y_c = [x - y for (x, y) in zip(x, y)]

ans = max(x_c) - min(x_c)

ans_1 = max(y_c) - min(y_c)

if ans < ans_1:
    ans = ans_1

print(ans)
import sys
from operator import itemgetter

N = int(input())
V = set()
for s in sys.stdin.readlines():
    x, y = 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())
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)))
if __name__ == '__main__':

    N = int(input())
    x = []
    y = []

    for _ in range(N):
        x_, y_ = map(int, input().split())
        x.append(x_)
        y.append(y_)
    xpy = [a + b for a, b in zip(x, y)]
    xmy = [a - b for a, b in zip(x, y)]
    max_1 = max(xpy)
    min_1 = min(xpy)
    max_2 = max(xmy)
    min_2 = min(xmy)
    print(max(max_1 - min_1,max_2 - min_2))
import sys
input = sys.stdin.buffer.readline

n = int(input())

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

x.sort()
y.sort()

res = max(x[-1]-x[0],y[-1]-y[0])

print(res)
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]))
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=[list(map(int,input().split()))for _ in range(n)]
xy1ma=-10**10
xy1mi=10**10
xy2ma=-10**10
xy2mi=10**10
for x,y in xy:
  xy1ma=max(xy1ma,x-y)
  xy1mi=min(xy1mi,x-y)
  xy2ma=max(xy2ma,x+y)
  xy2mi=min(xy2mi,x+y)
print(max(xy1ma-xy1mi,xy2ma-xy2mi))
n=int(input())
h=[]
add=[]
diff=[]
diff1=[]
for i in range(n):
  l=list(map(int,input().split()))
  h.append(l)
  p=h[i][0]+h[i][1]
  add.append(p)
  k=h[i][0]-h[i][1]
  diff.append(k)
  r=h[i][1]-h[i][0]
  diff1.append(r)
a=max(add)-min(add)
b=max(diff)-min(diff)
c=max(diff1)-min(diff1)
print(max(a,b,c))
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())
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)))
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())
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))))
n = int(input())
a = []
b = []

for i in range(n):
    x , y = map(int,input().split());
    a.append(x + y)
    b.append(x - y)

aa = max(a)-min(a)
bb = max(b)-min(b)

if aa >= bb:
    print(aa)
else:
    print(bb)
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from operator import sub

def resolve():
    it = map(int, sys.stdin.read().split())
    N = next(it)

    M = 10**9+1
    data = [[M, -M], [M, -M]]
    for x, y in zip(it, it):
        for i, x in enumerate([x+y, x-y]):
            for j, f in enumerate([min, max]):
                data[i][j] = f(data[i][j], x)

    print(max(map(lambda x: abs(sub(*x)), data)))



if __name__ == "__main__":
    resolve()
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

ans = max([max(x) - min(x),max(y) - min(y)])
print(ans)
# 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)))
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())
A = []
B = []
a_max = -float("inf")
a_min = float("inf")
b_max = -float("inf")
b_min = float("inf")
for _ in range(N):
    x, y = map(int, input().split())
    a_max = max(a_max, x-y)
    a_min = min(a_min, x-y)
    b_max = max(b_max, x+y)
    b_min = min(b_min, x+y)
print(max(a_max-a_min, b_max-b_min))
n = int(input())

zmax = -10**10
zmin = 10**10
wmax = -10**10
wmin = 10**10

for i in range(n):
    x, y = map(int, input().split())
    zref = x + y
    wref = x - y
    zmax = max(zmax, zref)
    zmin = min(zmin, zref)
    wmax = max(wmax, wref)
    wmin = min(wmin, wref)

ans = max(zmax - zmin, wmax - wmin)
print(ans)
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)
print(max(abs(A[0]-A[-1]),abs(B[0]-B[-1])))
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

z=[]
w=[]
for i in range(n):
  x,y=nii()
  z.append(x-y)
  w.append(x+y)

z_ans=max(z)-min(z)
w_ans=max(w)-min(w)
print(max(z_ans,w_ans))
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    p = [list(map(int, input().split())) for i in range(n)]

    p0, p1 = [0]*n, [0]*n

    for i in range(n):
        p0[i] = p[i][0] - p[i][1]
        p1[i] = p[i][0] + p[i][1]
    
    ans = max(max(p0)-min(p0), max(p1)-min(p1))
    print(ans)



    
if __name__ == "__main__":
    main()
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
x,y=[0]*N,[0]*N
for i in range(N):
    a,b=map(int,input().split())
    x[i],y[i]=a+b,a-b
x.sort()
y.sort()
print(max(max(x)-min(x),max(y)-min(y)))
import sys
input = sys.stdin.readline
def main():
    N = int( input())
    U = []
    V = []
    for _ in range(N):
        x, y = map( int, input().split())
        u, v = x+y, x-y
        U.append(u)
        V.append(v)
    U.sort()
    V.sort()
    print( max(U[-1]-U[0], V[-1]-V[0]))
if __name__ == '__main__':
    main()
n = int(input())

top1= -10**10
bot1= 10**10
top2= -10**10
bot2= 10**10
for _ in range(n):
	
	x,y = map(int, input().split(' '))
	tot1= x+y
	tot2= x-y
	if tot1> top1:
		top1= tot1
	if tot1< bot1:
		bot1= tot1
	if tot2>top2:
		top2= tot2
	if tot2<bot2:
		bot2= tot2

print(max(top1-bot1, top2-bot2))
N = int(input())
XY = []
for i in range(N):
    XY.append(list(map(int,input().split())))
ZW = []
for i in range(N):
    ZW.append([XY[i][0]-XY[i][1],XY[i][0]+XY[i][1]])

out = []
ZW.sort(key=lambda x:x[0])
out.append(abs(ZW[0][0]-ZW[N-1][0]))
ZW.sort(key=lambda x:x[1])
out.append(abs(ZW[0][1]-ZW[N-1][1]))
print(max(out))
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())
pp = []
pm = []
mp = []
mm = []

for i in range(n):
    x, y = list(map(int, input().split()))
    pp.append(x + y)
    pm.append(x - y)
    mp.append(-x + y)
    mm.append(-x - y)

max_pp = max(pp)
min_pp = min(pp)
max_pm = max(pm)
min_pm = min(pm)
max_mp = max(mp)
min_mp = min(mp)
max_mm = max(pm)
min_mm = min(pm)

max_val = max(max_pp - min_pp, max_pm - min_pm, max_mp - min_mp, max_mm - min_mm)
print(max_val)
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())
xy = [list(map(int, input().split())) for _ in range(n)]

xy.sort(key=lambda x: x[0] + x[1])
mn1, mx1 = xy[0], xy[-1]
xy.sort(key=lambda x: x[0] - x[1])
mn2, mx2 = xy[0], xy[-1]

li = [mn1, mx1, mn2, mx2]
ans = 0
for x1, y1 in li:
    for x2, y2 in li:
        dist = abs(x1 - x2) + abs(y1 - y2)
        ans = max(ans, dist)

print(ans)
import sys
input = sys.stdin.readline
def MI():
    return map(int, input().split())

n = int(input())
z=[]
w=[]
for i in range(n):
    x,y=MI()
    z.append(x+y)
    w.append(x-y)

print(max(max(z)-min(z), max(w)-min(w)))
n=int(input())
zmi=wmi=int(1e+10)
zma=wma=int(-1e+10)
for i in range(n):
    xi,yi=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))
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    d = []
    e = []
    for k in range(N):
        x, y = map(int,input().split())
        d.append(x+y)
        e.append(x-y)
    d.sort()
    e.sort()
    print(max(e[-1]-e[0],d[-1]-d[0]))

if __name__ == '__main__':
    main()
n = int(input())
XY = list(map(int, input().split()) for _ in range(n))
x_max = -float("inf")
y_max = -float("inf")
x_min = float("inf")
y_min = float("inf")
for x, y in XY:
    a, b = x-y, x+y
    x_max = max(x_max, a)
    x_min = min(x_min, a)
    y_max = max(y_max, b)
    y_min = min(y_min, b)
s = x_max - x_min
t = y_max - y_min
ans = max(s, t)
print(ans)
n = int(input())
a, b = [], []
for _ 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())
L = [list(map(int, input().split())) for _ in range(N)]
L_1 = [l[0]+l[1] for l in L]
L_2 = [(10**9+1-l[0])+l[1] for l in L]
L_3 = [(10**9+1-l[1])+l[0] for l in L]
L_4 = [(10**9+1-l[0])+(10**9+1-l[1]) for l in L]
L_1.sort()
a = L_1[-1]-L_1[0]
L_2.sort()
b = L_2[-1]-L_2[0]
L_3.sort()
c = L_3[-1]-L_3[0]
L_4.sort()
d = L_4[-1]-L_4[0]
print(max(a,b,c,d))
n = int(input())
a, b = [], []
for _ 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)
import sys
input = sys.stdin.buffer.readline

INF = 10**18

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]

XY.sort()

ans = 0
x0, y0 = XY[0]
m1 =  -x0+y0# 今ままでのmax
m2 = x0+y0
for x, y in XY:
    ans = max(ans, x+m1 - y)
    ans = max(ans, y - (-x+m2))
    m1 = max(m1, -x+y)
    m2 = min(m2, x+y)
print(ans)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
xy = [0] * n

xy_plus_max = -10 ** 10
xy_plus_min = 10 ** 10
xy_minus_max = -10 ** 10
xy_minus_min = 10 ** 10
for i in range(n):
    x, y = map(int, input().split())
    xy_plus_max = max(xy_plus_max, x + y)
    xy_plus_min = min(xy_plus_min, x + y)
    xy_minus_max = max(xy_minus_max, x - y)
    xy_minus_min = min(xy_minus_min, x - y)

print(max(xy_plus_max - xy_plus_min, xy_minus_max - xy_minus_min))
#

import sys
input=sys.stdin.readline

def main():
    N = int(input())
    R = [tuple(map(int, input().split())) for i in range(N)]
    A = sorted(R, key = lambda x: x[0] + x[1])
    B = sorted(R, key = lambda x: x[0] - x[1])
    a = abs(A[-1][0] - A[0][0]) + abs(A[-1][1] - A[0][1])
    b = abs(B[-1][0] - B[0][0]) + abs(B[-1][1] - B[0][1])
    print(max(a, b))
    
    
    
if __name__=="__main__":
    main()
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())
z = []
w = []
for i in range(n):
    x,y = map(int,input().split())
    z.append(x+y)
    w.append(x-y)
zmax = max(z)-min(z)
wmax = max(w)-min(w)
print(max(zmax,wmax))
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = []
B = []
for _ in range(N):
    x, y = map(int, readline().split())
    A.append(x+y)
    B.append(x-y)

a = max(A)
b = min(A)
c = max(B)
d = min(B)

print(max(abs(a-b),abs(c-d)))
num = int(input())
sumList = [0] * num
minusList = [0] * num
for id in range(num):
    x, y = map(int, input().split())
    sumList[id-1] = x + y
    minusList[id-1] = x - y
sumMax = max(sumList) - min(sumList)
minusMax = max(minusList) - min(minusList)
print(max(sumMax, minusMax))
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
dis1 = [0] * N
dis2 = [0] * N
for i in range(N):
        dis1[i] = x[i] + y[i]
        dis2[i] = x[i] - y[i]
max_dis1 = max(dis1)
min_dis1 = min(dis1)
max_dis2 = max(dis2)
min_dis2 = min(dis2)
max_dis = max([max_dis1 - min_dis1,-min_dis2 + max_dis2])
print(max_dis)
N = int(input())
table = [[int(i) for i in input().split()] for N in range(N)]

a = -1
b = 10**10
c = -10**10
d = 10**10
for i in range(N):
    p = table[i][0]
    q = table[i][1]
    if a < p+q:
        a = p+q
    if b > p+q:
        b = p+q
    if c < p-q:
        c = p-q
    if d > p-q:
        d = p-q

print(max(a-b,c-d))
def resolve():
    n = int(input())
    d1 = {}
    d2 = {}

    for i in range(n):
        x, y = map(int, input().split())
        if x+y not in d1:
            d1[x+y] = 1
        if x-y not in d2:
            d2[x-y] = 1
    d1key = d1.keys()
    d1key = sorted(d1key)
    d2key = d2.keys()
    d2key = sorted(d2key)
    print(max(abs(d1key[0]-d1key[-1]), abs(d2key[0]-d2key[-1])))
resolve()
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    # A:和、B:差
    A = [0] * N
    B = [0] * N
    for i in range(N):
        x, y = map(int, readline().split())
        A[i] = x+y
        B[i] = x-y

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


if __name__ == '__main__':
    main()
n = int(input())
l = [[0,0] for _ in range(n)]
for i in range(n):
    x,y = map(int,input().split())
    l[i] = [x-y,x+y]
ans = 0
for i in range(2):
    l2 = [l[j][i] for j in range(n)]
    ans = max(ans,max(l2)-min(l2))
print(ans)
N = int(input())
Zlist=[]
Wlist = []
for i in range(N):
    x,y = map(int,input().split())
    z = x+y
    w = x-y
    Zlist.append(z)
    Wlist.append(w)
Zlist.sort()
Wlist.sort()
print(max(Zlist[-1]-Zlist[0],Wlist[-1]-Wlist[0]))
n = int(input())
point = []
for _ in range(n):
    point.append((tuple(map(int, input().split()))))
point = list(set(point))
point = sorted(point)
if len(point) == 1: print(0)
else:  
    d1 = max([(x+y) for x,y in point])- min([(x+y) for x,y in point])
    d2 = max([(x-y) for x,y in point]) - min([(x-y) for x,y in point])
    print(max(d1,d2))
def main():
    n = int(input())
    z = [[], []]
    for i in range(n):
        x, y = 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]))



if __name__ == '__main__':
    main()
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)