#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 1e4 + 5;

typedef pair<int,int>   ii;

int x[N + N];
int tot = 0;

vector<int> perm;
vector<int> g[N << 3];

ii  tr[N << 3];
int id[N << 1];

void build(int v,int l,int r)   {
    if (l == r) {
        id[perm[l]] = v;
        return;
    }
    int m = (l + r) / 2;

    g[tr[v].X = ++tot].pb(v);   build(tot,l,m); ++m;
    g[tr[v].Y = ++tot].pb(v);   build(tot,m,r);
}
void add(int v,int l,int r,int L,int R,int u)   {
    if (l > R)  return;
    if (L > r)  return;

    if (L <= l && r <= R)   {
        g[v].pb(u);
        return;
    }
    int m = (l + r) / 2;

    add(tr[v].X,l,m,L,R,u); ++m;
    add(tr[v].Y,m,r,L,R,u);
}
void rem(int v,int l,int r,int L,int R) {
    if (l > R)  return;
    if (L > r)  return;

    if (L <= l && r <= R)   {
        g[v].pop_back();
        return;
    }
    int m = (l + r) / 2;

    rem(tr[v].X,l,m,L,R);   ++m;
    rem(tr[v].Y,m,r,L,R);
}
int dfn[N * 8];
int low[N * 8];
bool vis[N * 8];

stack<int>  st;

void dfs(int u) {
    tot++;
    dfn[u] = tot;
    low[u] = tot;
    vis[u] = 1;

    st.push(u);

    for(int v : g[u])   {
        if(!dfn[v]) {
            dfs(v);
            low[u] = min(low[u],low[v]);
        }
        else if (vis[v])
            low[u] = min(low[u],dfn[v]);
    }
    if (low[u] == dfn[u])   {
        int z;
        do  {
            z = st.top();   st.pop();
            low[z] = low[u];
            vis[z] = 0;
        }   while (z != u);
    }
}

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;  cin >> n;

    for(int i = 0 ; i < n ; ++i)    {
        cin >> x[i << 1];
        cin >> x[i << 1 | 1];
    }
    perm.resize(n + n);
    
    iota(all(perm),0);
    sort(all(perm),[&](int a,int b) {
        return  x[a] < x[b];
    });
    build(0,0,n + n - 1);

    int L = 0;
    int R = 1e9;

    while (L < R)   {
        int M = (L + R + 2) / 2;
        int p = 0;

        vector<ii>  seg(n + n);

        for(int i = 0 ; i < n + n ; ++i)    {
            while(x[perm[i]] - x[perm[p]] >= M)
                ++p;
            
            seg[i].X = p;
        }
        p = n + n - 1;

        for(int i = n + n - 1 ; i >= 0 ; --i)   {
            while(x[perm[p]] - x[perm[i]] >= M)
                --p;

            seg[i].Y = p;
        }
        for(int i = 0 ; i < n + n ; ++i)
            add(0,0,n + n - 1,seg[i].X,i - 1,id[perm[i] ^ 1]),
            add(0,0,n + n - 1,i + 1,seg[i].Y,id[perm[i] ^ 1]);

        tot = 0;
        
        for(int i = 0 ; i < n + n ; ++i)
            if(!dfn[id[i]])
                dfs(id[i]);
            
        bool ok = 1;
            
        for(int i = 0 ; i < n + n ; i += 2)
            if (low[id[i]] == low[id[i + 1]])   {
                ok = 0;
                break;
            }
        if(!ok) R = M - 1;
        else    L = M;
    
        for(int i = 0 ; i < n + n ; ++i)
            rem(0,0,n + n - 1,seg[i].X,i - 1),
            rem(0,0,n + n - 1,i + 1,seg[i].Y);
        
        fill(dfn,dfn + n * 8,0);
    }
    cout << L << endl;
}

Measured memory_bytes: 12640