#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<int SZ> struct scc {
    vi adj[SZ], radj[SZ], todo, allComp;
    int N, comp[SZ];
    bitset<SZ> visit;
    
    void dfs(int v) {
    	visit[v] = 1; 
    	for (int w: adj[v]) if (!visit[w]) dfs(w);
    	todo.pb(v);
    }
    
    void dfs2(int v, int val) {
    	comp[v] = val;
    	for (int w: radj[v]) if (!comp[w]) dfs2(w,val);
    }
    
    void addEdge(int a, int b) {
		adj[a].pb(b), radj[b].pb(a);
    }
    
    void genSCC() {
        F0R(i,N) comp[i] = visit[i] = 0;
    	F0R(i,N) if (!visit[i]) dfs(i);
    	reverse(all(todo)); // toposort 
    	for (int i: todo) if (!comp[i]) {
    	    dfs2(i,i);
    	    allComp.pb(i);
    	}
    }
};

scc<1<<16> S;

const int SZ = 1<<15;
int N;
vpi v;

void build(int ind, int L, int R, int pre) {
    if (L == R) {
        if (L < sz(v)) {
            S.addEdge(pre,SZ^v[L].s^1);
        }
    } else {
        if (pre) S.addEdge(pre,ind);
        int M = (L+R)/2;
        build(2*ind,L,M,ind);
        build(2*ind+1,M+1,R,ind);
    }
}
    
void ad(int x, int y) {
    // cout << x << " " << y << "\n";
    if (y >= SZ) {
        S.addEdge(x,SZ^v[y^SZ].s^1);
    } else {
        S.addEdge(x,y);
    }
}

void adLo(int lo, int ind) {
    int l = lo, r = ind;
    for (l += SZ, r += SZ; l < r; l >>= 1, r >>= 1) {
        if (l&1) ad(v[ind].s+(1<<15),l++);
        if (r&1) ad(v[ind].s+(1<<15),--r);
    }
}

void adHi(int hi, int ind) {
    int l = ind+1, r = hi+1;
    for (l += SZ, r += SZ; l < r; l >>= 1, r >>= 1) {
        if (l&1) ad(v[ind].s+(1<<15),l++);
        if (r&1) ad(v[ind].s+(1<<15),--r);
    }
}

bool posi(int d) {
    S = scc<1<<16>();
    build(1,0,(1<<15)-1,0);
    int lo = 0, hi = 0;
    F0R(i,sz(v)) {
        while (v[i].f-v[lo].f >= d) lo ++;
        while (hi < sz(v)-1 && v[hi+1].f-v[i].f < d) hi ++;
        // cout << lo << " " << i << " " << hi << "\n";
        adLo(lo,i);
        adHi(hi,i);
    }
    S.N = 1<<16;
    S.genSCC();
    F0R(i,N) if (S.comp[(1<<15)+(2*i)] == S.comp[(1<<15)+(2*i+1)]) {
        // cout << "OOPS " << i << " " << S.comp[(1<<15)+(2*i)] << "\n";
        return 0;
    }
    return 1;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    F0R(i,N) {
        int x,y; cin >> x >> y;
        v.pb({x,2*i});
        v.pb({y,2*i+1});
    }
    sort(all(v));
    /*for (auto a: v) cout << a.f << " " << a.s << "\n";
    
    cout << posi(100) << "\n";
    exit(0);*/
    int lo = 0, hi = 1e9;
    while (lo < hi) {
        int mid = (lo+hi+1)/2;
        if (posi(mid)) lo = mid;
        else hi = mid-1;
    }
    
    cout << lo;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 18772