#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define an size()

using namespace std;

const ll maxn=1e4+900;
ll x[maxn][2];
vector<pair<ll,ll> > st;
char viz[maxn];
ll m;
stack<ll> tagh;
bool bfs(ll a)
{
    vector<pair<ll,ll> > ::iterator it,itt;
    it=lower_bound(st.begin(),st.end(),mp(x[a][viz[a]-1]-m,(long long)0));
    itt =lower_bound(st.begin(),st.end(),mp(x[a][viz[a]-1]+m+1,(long long)0));
    stack<ll> sttk;
    ll u,j,er,ew;
    pair<ll,ll> ity;
    if (itt!=st.end())
    {
        ity=*itt;
    }
    else
    {
        ity=mp(1e10,1e10);
    }
    while ((*it).F<ity.F && it!=st.end() )
    {
        u=(*it).S;
        j=(*it).F;
        it++;
        if (u!=a)
        {
            if (x[u][0]==j)
            {
                ew=1;
                er=u;
                if (viz[er]==ew)
                {
                    return 0;
                }
                if (viz[er]==0)
                {
                    viz[er]=-ew+3;
                    tagh.push(er);
                    sttk.push(er);
                }
            }
            if (x[u][1]==j)
            {
                ew=2;
                er=u;
                if (viz[er]==ew)
                {
                    return 0;
                }
                if (viz[er]==0)
                {
                    viz[er]=-ew+3;
                    tagh.push(er);
                    sttk.push(er);
                }
            }
        }
    }
    while (!sttk.empty())
    {
        if (bfs(sttk.top())==0)
        {
            return 0;
        }
        sttk.pop();
    }
    return 1;
}

int main()
{
    ll n;
    cin>>n;
    for (ll i=0; i<n; i++)
    {
        cin>>x[i][0]>>x[i][1];
        st.pb(mp(x[i][0],i));
        st.pb(mp(x[i][1],i));
    }
    sort(st.begin(),st.end());
    ll s=0;
    ll t=1e9+900;




    /////////////////
    m=0;
    for (ll i=0; i<n; i++)
    {
        if (viz[i]==0)
        {
            viz[i]=rand()%2+1;
            if (!bfs(i))
            {
                while (!tagh.empty())
                {
                    viz[tagh.top()]=0;
                    tagh.pop();
                }
                viz[i]=-1*viz[i]+3;
                if (!bfs(i))
                {
                    cout<<0;
                    return 0;
                }
            }
            while (!tagh.empty())
            {
                tagh.pop();
            }
        }
    }

/////////////

    while (t-s>1)
    {
        m=s+t;
        m/=2;
        memset(viz,0,maxn);
        bool ok=1;
        for (ll i=n-1; i>=0; i--)
        {
            if (viz[i]==0)
            {
                viz[i]=rand()%2+1;
                if (!bfs(i))
                {
                    while (!tagh.empty())
                    {
                        viz[tagh.top()]=0;
                        tagh.pop();
                    }
                    viz[i]=-1*viz[i]+3;
                    if (!bfs(i))
                    {
                        ok=0;
                        break;
                    }
                }
                while (!tagh.empty())
                {
                    tagh.pop();
                }
            }
        }
        if (ok)
        {
            s=m;
        }
        else
        {
            t=m;
        }
    }

    cout<<s+1;
}


Measured memory_bytes: 1020