import std.conv, std.functional, std.range, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } real readReal() { return readToken.to!real; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } int N; long[] X, Y; bool check(long k) { auto as = new long[N]; auto bs = new long[N]; auto cs = new long[N]; auto ds = new long[N]; foreach (i; 0 .. N) { as[i] = X[i] + Y[i] - k; bs[i] = X[i] + Y[i] + k; cs[i] = X[i] - Y[i] - k; ds[i] = X[i] - Y[i] + k; } long maxA = long.min, minB = long.max; long maxC = long.min, minD = long.max; foreach (i; 0 .. N) { chmax(maxA, as[i]); chmin(minB, bs[i]); chmax(maxC, cs[i]); chmin(minD, ds[i]); } debug { writeln("check ", k); writeln(" as = ", as); writeln(" bs = ", bs); writeln(" cs = ", cs); writeln(" ds = ", ds); } bool sub(long p0, long q0, long p1, long q1) { foreach (i; 0 .. N) { if (as[i] <= p0 && p0 <= bs[i] && cs[i] <= q0 && q0 <= ds[i]) continue; if (as[i] <= p1 && p1 <= bs[i] && cs[i] <= q1 && q1 <= ds[i]) continue; return false; } return true; } if (sub(maxA, maxC, minB, minD)) return true; if (sub(maxA, minD, minB, maxC)) return true; return false; } void main() { try { for (; ; ) { N = readInt; X = new long[N]; Y = new long[N]; foreach (i; 0 .. N) { X[i] = readLong; Y[i] = readLong; } long lo = -1, hi = 4 * 10L^^9 + 10; for (; lo + 1 < hi; ) { const mid = (lo + hi) / 2; (check(mid) ? hi : lo) = mid; } writeln(hi); } } catch (EOFException e) { } }