#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define ld long double
#define PB push_back
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const ll maxn = 3e5 + 20 , N = 60000 + 20 , mod = 1e9 + 7 , INF = 1e9 + 10 , lg = 32;

int n , x[maxn] , y[maxn] , cmp[maxn];
vector <pii> vec;
vector <int> nodes , edges[maxn] , revedges[maxn] , gev;
bool mark[maxn];

inline int nt(ll x) {
    return x ^ 1;
}

inline void add_ed(int v, int u) {
    edges[v].PB(u);
    revedges[u].PB(v);
}

inline void add_cl(int v , int u) {
    add_ed(nt(v) , u);
    add_ed(nt(u) , v);
}

inline int find_seg_number(int v) {
    return n + v;
}

void find_nodes(int l , int r , int v = 1 , int s = 0 , int e = 2 * n) {
    if(l >= e || s >= r) {
        return;
    }
    if(l <= s && e <= r) {
        int num = find_seg_number(v);
        nodes.PB(num);
        return;
    }
    find_nodes(l , r , lc , s , mid);
    find_nodes(l , r , rc , mid , e);
}

void add_edge(int v , int l , int r) {
    nodes.clear();
    find_nodes(l , r);
    for (int u : nodes) {
        add_cl(nt(v) , nt(2 * u));
    }
}

void build(int v = 1 , int s = 0 , int e = 2 * n) {
    int num1 = find_seg_number(v);
    if(e - s == 1) {
        int num2 = vec[s].S;
        add_cl(2 * num1 , nt(num2));
        return;
    }
    build(lc , s , mid);
    build(rc , mid , e);
    int a = find_seg_number(lc);
    int b = find_seg_number(rc);
    add_cl(2 * num1 , nt(2 * a));
    add_cl(2 * num1 , nt(2 * b));
}

void dfs1(int v) {
    mark[v] = 1;
    for (auto u : edges[v]) {
        if(!mark[u]) {
            dfs1(u);
        }
    }
    gev.PB(v);
}

void dfs2(int v, int c) {
    cmp[v] = c;
    for (auto u : revedges[v]) {
        if(!cmp[u])
            dfs2(u , c);
    }
}

bool check(int d) {
    for (int i = 0; i < 18 * n; ++i) {
        edges[i].clear();
        revedges[i].clear();
        mark[i] = cmp[i] = 0;
    }
    gev.clear();
    build();

    for (int i = 0; i < vec.size(); ++i) {
        pii u = vec[i];
        pii c1 = {u.F + d , -1};
        int s = i + 1;
        int e = lower_bound(vec.begin() , vec.end() , c1) - vec.begin();
        // cout << u.S << ' ' << d << ' ' << s << ' ' << e << endl;
        // for (int i = s; i < e; ++i) {
        //     add_cl(nt(2 * u.S) , nt())
        // }
        add_edge(u.S , s , e);
    }

    for (int i = 0; i < 18 * n; ++i) {
        if(!mark[i]) {
            dfs1(i);
        }
    }
    int cnt = 1;
    reverse(gev.begin() , gev.end());
    for (int i : gev) {
        if(!cmp[i]) {
            dfs2(i , cnt);
            cnt++;
        }
    }

    // for (int i = 0; i < 5 * n; ++i) {
    //     cout << cmp[2 * i] << ' ' << cmp[2 * i + 1] << endl;
    // }

    for (int i = 0; i < 9 * n; ++i) {
        if(cmp[2 * i] == cmp[2 * i + 1]) {
            return 0;
        }
    }
    return 1;
}

int main() {
    FAST
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
        vec.PB({x[i] , 2 * i});
        vec.PB({y[i] , nt(2 * i)});
    }
    sort(vec.begin() , vec.end());
    // cout << check(4) << ' ' << check(5) << endl;
    ll l = 0 , r = INF;
    while(l < r - 1) {
        ll m = (l + r) / 2;
        if(check(m)) {
            l = m;
        }
        else {
            r = m;
        }
    }
    cout << l <<'\n';
}


Measured memory_bytes: 41420