#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

class SAT {
private:
    void _dfs(int u){
		used[u] = true;
		for(int v : G[u]){
			if(!used[v]){
				_dfs(v);
			}
		}
		post_order.push_back(u);
	}
    void _rdfs(int u,int k){
		used[u] = true;
		cmp[u] = k;
		for(int v : rG[u]){
			if(!used[v]){
				_rdfs(v,k);
			}
		}
	}
    int _scc(){
        fill(used.begin(),used.end(),false);
        post_order.clear();
        for(int i = 0; i < 2 * V; i++){
            if(!used[i]){
                _dfs(i);
            }
        }
        fill(used.begin(),used.end(),false);
        int k = 0;
        for(int i = 2*V - 1; i >= 0; i--){
            if(!used[post_order[i]]){
                _rdfs(post_order[i],k++);
            }
        }
        return k;
    }

public:
	int V;	//頂点数
	vector<vector<int> > G,rG;
	vector<int> post_order; //帰りがけ順の並び
	vector<bool> used; //すでに調べたかどうか
	vector<int> cmp;	//属する強連結成分のトポロジカル順序

	SAT(int node_size) : V(node_size), G(2*V), rG(2*V), used(2*V), cmp(2*V){}
	inline void _add_edge(int from, int to){
		G[from].push_back(to), rG[to].push_back(from);
	}
    inline void add_edge(int from, int to){
		_add_edge(from, to), _add_edge((to+V)%(2*V),(from+V)%(2*V));
	}
	//充足可能性判定
	bool ok(){
	    _scc();
	    for(int i = 0; i < V; i++){
	        if(cmp[i] == cmp[V+i]){
	            return false;
	        }
	    }
	    return true;
	}
	//真のものは1,偽のものは0を返す(解の構成)
	void restore(vector<int>& ans){
		ans.resize(V);
	    for(int i = 0; i < V; i++){
			ans[i] = (cmp[i] > cmp[V+i]);
	    }
	}
};

int n, N, V;
vector<P> vec, num;

inline void query(const int id, int a, int b, SAT& st, int k = 0, int l = 0, int r = -1){
    if(r < 0) r = N;
    if(r <= a || b <= l){
        return;
    }
    if(a <= l && r <= b){
        st.add_edge(id, k+V);
        return;
    }else{
        query(id,a,b,st,2*k+1,l,(l+r)/2), query(id,a,b,st,2*k+2,(l+r)/2,r);
    }
}

bool possible(int d)
{
    SAT st(V);
    rep(i,n){
		st.add_edge(num[i].fi+N-1+V, num[i].se+N-1);
    }
    for(int i=N-2; i>=0; i--){
		st.add_edge(2*i+1, i), st.add_edge(2*i+2, i);
    }
    rep(i,2*n){
        int s = lower_bound(all(vec),P(vec[i].fi-d+1,-1)) - vec.begin();
        if(s < i) query(i+N-1, s, i, st);
        int e = upper_bound(all(vec),P(vec[i].fi+d-1,INF)) - vec.begin();
        if(i+1 < e) query(i+N-1, i+1, e, st);
    }
    return st.ok();
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vec.resize(2*n);
    N = 1;
    while(N < 2*n){
        N *= 2;
    }
    V = 2*N-1;
    num.resize(n, P(-1, -1));
    rep(i,n){
        int x,y;
        cin >> x >> y;
        vec[2*i] = P(x,i), vec[2*i+1] = P(y,i);
    }
    sort(all(vec));
    rep(i,2*n){
        int id = vec[i].se;
        if(num[id].fi < 0){
            num[id].fi = i;
        }else{
            num[id].se = i;
        }
    }
    int l = 0, r = vec.back().fi - vec[0].fi + 1;
    while(r-l>1){
        int mid = (l+r)/2;
        if(possible(mid)){
            l = mid;
        }else{
            r = mid;
        }
    }
    cout << l << "\n";
    return 0;
}


Measured memory_bytes: 35228