/*        All is Well        */
#include <bits/stdc++.h>
using namespace std;
#define tera_baap_aaya main
#define TEZZ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);//
#define ll long long int
#define PB push_back
#define MP make_pair
const ll C=1e9+7;
////////////////////
bool checkprime(ll n)
{
    for (ll i=2;i*i<=n;i++)
    {
        if (n%i==0)
        {
            return false;
        }
    }
    return true;
}//////////
ll ncr(int n, int r)
{
    if (r>n)
    {
        return 0;
    }
    r=min(r,n-r);
    ll num=1,den=1;
    for (int i=0;i<r;i++)
    {
        num*=n-i;
        den*=i+1;
        ll g=__gcd(num,den);
        num/=g;
        den/=g;
    }
    return num;
}//////////
ll pasc_triangle(int n, int r)
{
    if (r>n)
    {
        return 0;
    }
    r=min(r,n-r);
    if (r==0)
    {
        return 1;
    }
    vector <ll> a;
    a.PB(1);
    for (int i=0;i<n-1;i++)
    {
        vector <ll> b;
        b.PB(1);
        for (int j=1;j<a.size();j++)
        {
            b.PB((a[j]+a[j-1])%C);
        }
        b.PB(1);
        a=b;
    }
    return (a[r]+a[r-1])%C;
}//////////
vector <ll> fact(200000+1);
void factarray()
{
    fact[0]=1%C;
    for (int i=1;i<200000+1;i++)
    {
        fact[i]=(fact[i-1]*i)%C;
    }
}//////////
ll modpower(ll n,ll p)
{
    if (p==0)
    {
        return 1%C;
    }
    ll m=modpower(n,p/2);
    m*=m;
    m%=C;
    if (p%2)
    {
        m*=n%C;
        m%=C;
    }
    return m;
}//////////
ll modinverse(ll n)
{
    return modpower(n, C-2);
}//////////
ll ncrmodc(int n,int r)
{
    if (r>n)
    {
        return 0;
    }
    r=min(r,n-r);
    return ((fact[n]*modinverse(fact[r]))%C*modinverse(fact[n-r]))%C;
}//////////
/******************/
void solve()
{
    int n;
    cin>>n;
    vector <pair <ll, ll>> p1(n),p2(n);
    for (int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        p1[i]=MP(x,y);
        p2[i]=MP(y,x);
    }
    sort(p1.begin(),p1.end());
    sort(p2.begin(),p2.end());
    ll ans1=abs(p1[0].first-p1[n-1].first),ans2=abs(p2[0].first-p2[n-1].first),ans3,ans4,ans5,ans6;
    ans3=abs(p1[1].first-p1[n-1].first);
    ans4=abs(p1[0].first-p1[n-2].first);
    ans5=abs(p2[1].first-p2[n-1].first);
    ans6=abs(p2[0].first-p2[n-2].first);
    //ll x=abs(p1[0].second-p1[n-1].second),y=abs(p2[0].second-p2[n-1].second);
    set <pair <ll, ll>> s1,s2;
    s1.insert(p1[0]);
    s1.insert(p1[n-1]);
    s2.insert(MP(p2[0].second,p2[0].first));
    s2.insert(MP(p2[n-1].second,p2[n-1].first));
    if (s1==s2)
    {
        cout<<max({ans3, ans4, ans5, ans6});
        return;
    }
    if (ans1==ans2)
    {
        cout<<ans1;
        return;
    }
    if (ans1>ans2)
    {
        cout<<max({ans2, ans3, ans4});
        return;
    }
    if (ans1<ans2)
    {
        cout<<max({ans1, ans5, ans6});
        return;
    }
}//////////
////////////////////
int tera_baap_aaya()
{
    TEZZ;
    int t=1;
    //cin>>t;
    cout<<fixed<<setprecision(8);
    //factarray();
    while (t--)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}
/*..fir milenge chalte chalte*/
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  
  int x, y;
  vector<vector<int>> xmin(2, vector<int> {0, 1000000001});
  vector<vector<int>> xmax(2, vector<int> {0, -1000000001});
  vector<vector<int>> ymin(2, vector<int> {0, 1000000001});
  vector<vector<int>> ymax(2, vector<int> {0, -1000000001});
  for(int i = 0; i<N; i++){
    cin >> x >> y;
    if(x < xmin.at(0).at(1)){
      xmin.at(1).at(1) = xmin.at(0).at(1);
      xmin.at(1).at(0) = xmin.at(0).at(0);
      xmin.at(0).at(1) = x;
      xmin.at(0).at(0) = i;
    }
    else if (x < xmin.at(1).at(1)){
      xmin.at(1).at(1) = x;
      xmin.at(1).at(0) = i;
    }
    if(x > xmax.at(0).at(1)){
      xmax.at(1).at(1) = xmax.at(0).at(1);
      xmax.at(1).at(0) = xmax.at(0).at(0);
      xmax.at(0).at(1) = x;
      xmax.at(0).at(0) = i;
    }
    else if (x > xmax.at(1).at(1)){
      xmax.at(1).at(1) = x;
      xmax.at(1).at(0) = i;
    }
    if(y < ymin.at(0).at(1)){
      ymin.at(1).at(1) = ymin.at(0).at(1);
      ymin.at(1).at(0) = ymin.at(0).at(0);
      ymin.at(0).at(1) = y;
      ymin.at(0).at(0) = i;
    }
    else if (y < ymin.at(1).at(1)){
      ymin.at(1).at(1) = y;
      ymin.at(1).at(0) = i;
    }
    if(y > ymax.at(0).at(1)){
      ymax.at(1).at(1) = ymax.at(0).at(1);
      ymax.at(1).at(0) = ymax.at(0).at(0);
      ymax.at(0).at(1) = y;
      ymax.at(0).at(0) = i;
    }
    else if (y > ymax.at(1).at(1)){
      ymax.at(1).at(1) = y;
      ymax.at(1).at(0) = i;
    }
  }
  
  vector<vector<int>> ans(3, vector<int>(3, -2000000001));
  for(int i = 0; i<2; i++){
    for(int j = 0; j<2; j++){
      int v = xmax.at(j).at(1) - xmin.at(i).at(1);
      if(v > ans.at(0).at(0)){
        ans.at(2) = ans.at(1);
        ans.at(1) = ans.at(0);
        ans.at(0).at(0) = v;
        ans.at(0).at(1) = min(xmax.at(j).at(0), xmin.at(i).at(0));
        ans.at(0).at(2) = max(xmax.at(j).at(0), xmin.at(i).at(0));
      }
      else if(v > ans.at(1).at(0)){
        ans.at(2) = ans.at(1);
        ans.at(1).at(0) = v;
        ans.at(1).at(1) = min(xmax.at(j).at(0), xmin.at(i).at(0));
        ans.at(1).at(2) = max(xmax.at(j).at(0), xmin.at(i).at(0));
      }
      else if(v > ans.at(2).at(0)){
        ans.at(2).at(0) = v;
        ans.at(2).at(1) = min(xmax.at(j).at(0), xmin.at(i).at(0));
        ans.at(2).at(2) = max(xmax.at(j).at(0), xmin.at(i).at(0));
      }
      v = ymax.at(j).at(1) - ymin.at(i).at(1);
      if(v > ans.at(0).at(0)){
        ans.at(2) = ans.at(1);
        ans.at(1) = ans.at(0);
        ans.at(0).at(0) = v;
        ans.at(0).at(1) = min(ymax.at(j).at(0), ymin.at(i).at(0));
        ans.at(0).at(2) = max(ymax.at(j).at(0), ymin.at(i).at(0));
      }
      else if(v > ans.at(1).at(0)){
        ans.at(2) = ans.at(1);
        ans.at(1).at(0) = v;
        ans.at(1).at(1) = min(ymax.at(j).at(0), ymin.at(i).at(0));
        ans.at(1).at(2) = max(ymax.at(j).at(0), ymin.at(i).at(0));
      }
      else if(v > ans.at(2).at(0)){
        ans.at(2).at(0) = v;
        ans.at(2).at(1) = min(ymax.at(j).at(0), ymin.at(i).at(0));
        ans.at(2).at(2) = max(ymax.at(j).at(0), ymin.at(i).at(0));
      }
    }
  }
  
  if (ans.at(0).at(1) == ans.at(1).at(1) && ans.at(0).at(2) == ans.at(1).at(2)){
    cout << ans.at(2).at(0) << endl;
  }
  else {
    cout << ans.at(1).at(0) << endl;
  }
}