#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } vector> manhattan_mst(vector xs, vector ys) { assert(xs.size() == ys.size()); vector> ret; int n = (int) xs.size(); vector< int > ord(n); iota(ord.begin(), ord.end(), 0); for(int s = 0; s < 2; s++) { for(int t = 0; t < 2; t++) { auto cmp = [&](int i, int j) -> bool { return xs[i] + ys[i] < xs[j] + ys[j]; }; sort(ord.begin(), ord.end(), cmp); map< int, int > idx; for(int i:ord) { for(auto it = idx.lower_bound(-ys[i]); it != idx.end(); it = idx.erase(it)) { int j = it->second; if(xs[i] - xs[j] < ys[i] - ys[j]) break; ret.emplace_back(i, j, abs(xs[i] - xs[j]) + abs(ys[i] - ys[j])); } idx[-ys[i]] = i; } swap(xs, ys); } for(int i = 0; i < n; i++) xs[i] *= -1; } return ret; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector x(n), y(n), p(n, 1 << 30); for(int i = 0; i < n; i++){ cin >> x[i] >> y[i]; } auto edge = manhattan_mst(x, y); int mx1 = x[0] - y[0], mn1 = mx1; int mx2 = x[0] + y[0], mn2 = mx2; for(int i = 0; i < n; i++){ mn1 = min(mn1, x[i] - y[i]); mx1 = max(mx1, x[i] - y[i]); mn2 = min(mn2, x[i] + y[i]); mx2 = max(mx2, x[i] + y[i]); } for(int i = 0; i < edge.size(); i++){ int u, v, d; tie(u, v, d) = edge[i]; p[u] = min(p[u], d); p[v] = min(p[v], d); } int ans = 1 << 30; for(int i = 0; i < n; i++){ int v1 = x[i] - y[i], v2 = x[i] + y[i]; ans = min(ans, max(max(abs(mn1 - v1), abs(mx1 - v1)), max(abs(mn2 - v2), abs(mx2 - v2))) - p[i]); } cout << ans << '\n'; }