#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 TwoSAT {
private:
	const int V;
	vector<vector<int> > G, rG;
	vector<int> ps, cmp;
	void add_edge(int from, int to){
		G[from].push_back(to), rG[to].push_back(from);
	}
	void dfs(int u){
        cmp[u] = 0;
        for(int v : G[u]){
			if(cmp[v] == -1) dfs(v);
		}
		ps.push_back(u);
	}
	void rdfs(int u, int k){
		cmp[u] = k;
		for(int v : rG[u]){
			if(cmp[v] == -1) rdfs(v, k);
		}
	}
	int scc(){
		for(int i = 0; i < 2 * V; ++i){
			if(cmp[i] == -1) dfs(i);
		}
		fill(cmp.begin(), cmp.end(), -1);
		int k = 0;
		for(int i = 2 * V - 1; i >= 0; --i){
			if(cmp[ps[i]] == -1) rdfs(ps[i], k++);
		}
		return k;
	}

public:
	vector<int> ans;
	TwoSAT(const int literal_count)
	 	: V(literal_count), G(2 * V), rG(2 * V), cmp(2 * V, -1), ans(V){}
	void add_closure(int x, int y){
		add_edge((x + V) % (2 * V), y), add_edge((y + V) % (2 * V), x);
	}
	// 充足可能性判定
	// 真のものは 1,偽のものは 0 が ans に格納される(解の構成)
	bool satisfy(){
		scc();
		for(int i = 0; i < V; i++){
			if(cmp[i] == cmp[V + i]) return false;
			ans[i] = (cmp[i] > cmp[V + i]);
		}
		return true;
	}
};

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

inline void query(const int id, int a, int b, TwoSAT& 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_closure(id+V, 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)
{
    TwoSAT st(V);
    rep(i,n){
		st.add_closure(num[i].fi+N-1, num[i].se+N-1);
    }
    for(int i=N-2; i>=0; i--){
		st.add_closure(2*i+1+V, i), st.add_closure(2*i+2+V, 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.satisfy();
}

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: 34236