#include <bits/stdc++.h>
using namespace std;
#define ll long long
// template <class T = ll> using P = pair< T,T>;
template <class T = ll> using V = vector<T>;
template <class T = ll> using VV = V<V<T>>;
#define rep(i,n) for(int i=0; i<(n);++i)
#define repp(i, l, r) for(int i = (l); i < (r); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()


int main()
{
    int n;
    cin >> n;
    V<pair<int,int>> x(n);
    V<pair<int,int>> y(n);
    rep(i, n) {
        cin >> x[i].first >> y[i].first;
        x[i].second = i;
        y[i].second = i;
    }
    sort(all(x), greater<pair<int,int>>());
    sort(all(y), greater<pair<int,int>>());

    V<pair<pair<int,int>,int>> ans;
    {
        pair<pair<int,int>,int> can;
        pair<int,int> a;
        a.first = x[0].second;
        a.second = x[n-1].second;
        can.first = a;
        can.second = x[0].first - x[n-1].first;
        ans.push_back(can);
    }
        {
        pair<pair<int,int>,int> can;
        pair<int,int> a;
        a.first = y[0].second;
        a.second = y[n-1].second;
        can.first = a;
        can.second = y[0].first - y[n-1].first;
        ans.push_back(can);
    }
        {
        pair<pair<int,int>,int> can;
        pair<int,int> a;
        a.first = x[1].second;
        a.second = x[n-1].second;
        can.first = a;
        can.second = x[1].first - x[n-1].first;
        ans.push_back(can);
    }
        {
        pair<pair<int,int>,int> can;
        pair<int,int> a;
        a.first = x[0].second;
        a.second = x[n-2].second;
        can.first = a;
        can.second = x[0].first - x[n-2].first;
        ans.push_back(can);
    }
        {
        pair<pair<int,int>,int> can;
        pair<int,int> a;
        a.first = y[1].second;
        a.second = y[n-1].second;
        can.first = a;
        can.second = y[1].first - y[n-1].first;
        ans.push_back(can);
    }
        {
        pair<pair<int,int>,int> can;
        pair<int,int> a;
        a.first = y[0].second;
        a.second = y[n-2].second;
        can.first = a;
        can.second = y[0].first - y[n-2].first;
        ans.push_back(can);
    }
    sort(all(ans), [](auto lhs, auto rhs){return lhs.second > rhs.second;});
    ll cnt = 0;
    pair<int,int> pre;
    for(auto abc : ans){
        if(pre == abc.first) continue;
        cnt++;
        pre = abc.first;
        if(cnt == 2){
            cout << abc.second << endl;
        }
    }

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int,int> > x,y;
vector<int> ans;
map<pair<int,int>,int > ma;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int u,v;
        cin>>u>>v;
        x.push_back({u,i});
        y.push_back({v,i});
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    int a=x.size();
    int b=y.size();
    for(int i=a-1;i>=a-3;i--)
    {
        ans.push_back(abs(x[0].first-x[i].first));
        ma[{x[0].second,x[i].second}]=1;
    }
    for(int i=0;i<3;i++)
    {
        if(ma[{x[i].second,x[x.size()-1].second}]==0)
            {
                ans.push_back(abs(x[i].first-x[x.size()-1].first));
                ma[{x[i].second,x[x.size()-1].second}]=1;
            }
    }
    for(int i=b-1;i>=b-3;i--)
    {
        if(ma[{y[0].second,y[i].second}]==0)
            {
                ans.push_back(abs(y[0].first-y[i].first));
                ma[{y[0].second,y[i].second}]=1;
            }
    }
    for(int i=0;i<3;i++)
    {
        if(ma[{y[i].second,y[x.size()-1].second}]==0)
            {
                ans.push_back(abs(y[i].first-y[x.size()-1].first));
                ma[{x[i].second,x[x.size()-1].second}]=1;
            }
    }
    sort(ans.begin(),ans.end());
    cout<<ans[ans.size()-2];
}
