#include #pragma GCC optimize("Ofast") #define _GLIBCXX_DEBUG using namespace std; using ll=long long; using ld=long double; ll ILL=2167167167167167167; const int INF=2100000000; const ll mod=998244353; #define rep(i,a) for (ll i=0;i using _pq = priority_queue, greater>; template ll LB(vector &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();} template ll UB(vector &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();} template bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;} template bool chmax(T &a,const T &b){if(a void So(vector &v) {sort(v.begin(),v.end());} template void Sore(vector &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});} void yneos(bool a){if(a) cout<<"Yes\n"; else cout<<"No\n";} template void vec_out(vector &p){for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout<>t; rep(i,t) solve(); } void solve(){ int N; cin>>N; vector> p(N); rep(i,N){ ll x,y; cin>>x>>y; p[i]={x+y,x-y}; } if(N<=2){ cout<<"0\n"; return ; } So(p); ll l=-1,r=INF; while(r-l>1){ ll med=(l+r)/2; map m1,m2; int J=0; vector>> q; ll A=ILL,B=-ILL,C=ILL,D=-ILL; rep(i,N){ if(i==0) continue; m1[p[i].second]++; m2[p[i].first]++; if(max(abs(p[i].second-p[0].second),abs(p[i].first-p[0].first))<=med*2){ q.push_back({-1,{p[i].second,p[i].first}}); q.push_back({1,{p[i].second+med*2,p[i].first}}); }else{ chmin(A,p[i].second); chmax(B,p[i].second); chmin(C,p[i].first); chmax(D,p[i].second); } } if(max(B-A,D-C)>med*2){ l=med; continue; } sort(all(q),[](auto L,auto R){ if(L.second.first==R.second.first) return L