#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) template bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; int main(){ int n; cin>>n; int sz=2e3+10; vector> fld(sz,vector(sz)); int shf=1e3+5; rep(i,0,n){ int x,y; cin>>x>>y; fld.at(x+y+5).at(x-y+shf)++; } rep(i,1,sz) rep(j,0,sz) fld.at(i).at(j)+=fld.at(i-1).at(j); rep(i,0,sz) rep(j,1,sz) fld.at(i).at(j)+=fld.at(i).at(j-1); //rep(i,0,sz){ // rep(j,0,sz){ // cout<>m; rep(lp,0,m){ int z,w; cin>>z>>w; int nz=z+w+5,nw=z-w+shf; vector dd={0,1,0,-1,0}; auto check=[&](int d) ->int { int tmp=0; { int nnz=max(nz-d-1,0); int nnw=max(nw-d-1,0); tmp+=fld.at(nnz).at(nnw); } { int nnz=max(nz-d-1,0); int nnw=min(nw+d,sz-1); tmp-=fld.at(nnz).at(nnw); } { int nnz=min(nz+d,sz-1); int nnw=max(nw-d-1,0); tmp-=fld.at(nnz).at(nnw); } { int nnz=min(nz+d,sz-1); int nnw=min(nw+d,sz-1); tmp+=fld.at(nnz).at(nnw); } return tmp>0; }; int up=1e5; int dw=-1; while(up-dw>1){ int md=(up+dw)/2; if(check(md)) up=md; else dw=md; } chmin(ans,up); } cout<