#include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } typedef pair S; S op(S a, S b){ if (a.first < b.first){ return a; } return b; } S e(){ return pair((int)1e9, -1); } int main(){ int n; cin >> n; vector x(n), y(n); rep(i,0,n) cin >> x[i] >> y[i]; vector mindist(n, 1e9); rep(i,0,2){ rep(j,0,2){ rep(k,0,2){ vector> d(n); segtree seg(2*n + 1); rep(l,0,n) d[l] = pair(y[l] - x[l], l); sort(d.begin(), d.end()); rep(l,0,n){ int s = d[l].second; S r = seg.prod(y[s] + n, 2*n+1); if (r.second != -1){ chmin(mindist[r.second], abs(x[s] + y[s] - r.first)); chmin(mindist[s], abs(x[s] + y[s] - r.first)); } seg.set(y[s] + n, op(seg.get(y[s] + n), pair(x[s] + y[s], s))); } swap(x, y); } rep(l,0,n) x[l] = - x[l]; } rep(l,0,n) y[l] = - y[l]; } vector a(n), b(n); rep(i,0,n){ a[i] = x[i] + y[i]; b[i] = x[i] - y[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); int ans = 1e9; rep(i,0,n){ int tmp = 0; chmax(tmp, abs(a[n-1] - (x[i] + y[i]))); chmax(tmp, abs(a[0] - (x[i] + y[i]))); chmax(tmp, abs(b[n-1] - (x[i] - y[i]))); chmax(tmp, abs(b[0] - (x[i] - y[i]))); chmin(ans, tmp - mindist[i]); } cout << ans << '\n'; }