#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using Int = long long; template ostream &operator<<(ostream &os, const pair &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template ostream &operator<<(ostream &os, const vector &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; } template void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; } template bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; } #define COLOR(s) ("\x1b[" s "m") constexpr Int INF = 1001001001001001001LL; int N; vector X, Y; bool solve(Int thr, int k, const vector &us) { if (!us.size()) return true; if (!k) return false; Int xs[2] = {-INF, +INF}; Int ys[2] = {-INF, +INF}; for (const int u : us) { chmax(xs[0], X[u]); chmin(xs[1], X[u] + thr); chmax(ys[0], Y[u]); chmin(ys[1], Y[u] + thr); } for (int s = 0; s < 2; ++s) for (int t = 0; t < 2; ++t) { vector vs; for (const int u : us) { if (true && X[u] <= xs[s] && xs[s] <= X[u] + thr && Y[u] <= ys[t] && ys[t] <= Y[u] + thr ) { // } else { vs.push_back(u); } } if (solve(thr, k - 1, vs)) { return true; } } return false; } bool check(Int thr) { vector us(N); for (int u = 0; u < N; ++u) us[u] = u; return solve(thr, 3, us); } int main() { for (; ~scanf("%d", &N); ) { X.resize(N); Y.resize(N); for (int u = 0; u < N; ++u) { int a, b; scanf("%d%d", &a, &b); X[u] = a + b; Y[u] = a - b; } Int lo = -1, hi = 1001001001LL; for (; lo + 1 < hi; ) { const Int mid = (lo + hi) / 2; (check(mid) ? hi : lo) = mid; } printf("%lld\n", hi); } return 0; }