#include "bits/stdc++.h"
using namespace std;
const int N = 2e4 + 4;
const int SN = 1 << 17;
int n;
int a , b;
pair < int , int > arr[N];
vector < int > segtree[SN];
int num[SN];
int lol[SN];
int cur;
vector < int > v[SN];
int neg(int x){
    if(x <= (n >> 1)){
        return x + (n >> 1);
    }
    else{
        return x - (n >> 1);
    }
}
void clear(int l , int r , int node){
    segtree[node].clear();
    num[node] = ++cur;
    if(l < r){
        int mid = l + r >> 1;
        clear(l , mid , node + node);
        clear(mid + 1 , r , node + node + 1);
    }
}
void pre(int l , int r , int node){
    lol[node] = ++cur;
    if(l < r){
        int mid = l + r >> 1;
        lol[node] = ++cur;
        pre(l , mid , node + node);
        pre(mid + 1 , r , node + node + 1);
    }
}
void update(int l , int r , int node , int ql , int qr , int val){
    if(l > qr || r < ql){
        return;
    }
    if(l >= ql && r <= qr){
        segtree[node].emplace_back(val);
        return;
    }
    int mid = l + r >> 1;
    update(l , mid , node + node , ql , qr , val);
    update(mid + 1 , r , node + node + 1 , ql , qr , val);
}
void go(int idx , int node){
    while(node){
        v[num[node]].emplace_back(neg(idx));
        v[idx].emplace_back(lol[node]);
        node >>= 1;
    }
}
void build(int l , int r , int node){
    for(int x : segtree[node]){
        v[x].emplace_back(num[node]);
        v[lol[node]].emplace_back(neg(x));
    }
    if(l == r){
        go(arr[l].second , node);
    }
    else{
        int mid = l + r >> 1;
        build(l , mid , node + node);
        build(mid + 1 , r , node + node + 1);
    }
}
int tin[SN];
int anc[SN];
int ins[SN];
int stk[SN];
int scc[SN];
int tim;
int siz;
int cmp;
void dfs(int node , int parent){
    tin[node] = anc[node] = ++tim;
    stk[++siz] = node;
    ins[node] = 1;
    for(int next : v[node]){
        if(next != parent){
            if(tin[next]){
                if(ins[next]){
                    anc[node] = min(anc[node] , tin[next]);
                }
            }
            else{
                dfs(next , node);
                anc[node] = min(anc[node] , anc[next]);
            }
        }
    }
    if(anc[node] == tin[node]){
        int tmp;
        ++cmp;
        do{
            tmp = stk[siz--];
            scc[tmp] = cmp;
            ins[tmp] = 0;
        }while(tmp != node);
    }
}
void findscc(){
    tim = 0;
    siz = 0;
    cmp = 0;
    for(int i = 1 ; i <= cur ; ++i){
        ins[i] = 0;
        anc[i] = 0;
        tin[i] = 0;
        stk[i] = 0;
    }
    for(int i = 1 ; i <= cur ; ++i){
        if(!tin[i]){
            dfs(i , 0);
        }
    }
}
bool check(int d){
    cur = n;
    clear(1 , n , 1);
    pre(1 , n , 1);
    for(int i = 1 ; i <= cur ; ++i){
        v[i].clear();
    }
    int idx = 1;
    arr[n + 1].first = 1e9 + 9;
    for(int i = 1 ; i <= n ; ++i){
        while(arr[idx].first <= arr[i].first - d){
            ++idx;
        }
        if(idx < i){
            update(1 , n , 1 , idx , i - 1 , arr[i].second);
        }
    }
    build(1 , n , 1);
    findscc();
    for(int i = 1 ; i <= n ; ++i){
        if(scc[i] == scc[neg(i)]){
            return 0;
        }
    }
    return 1;
}
int main(){
    scanf("%d" , &n);
    for(int i = 1 ; i <= n ; ++i){
        scanf("%d %d" , &a , &b);
        arr[2 * i - 1] = make_pair(a , i);
        arr[2 * i] = make_pair(b , i + n);
    }
    n *= 2;
    sort(arr + 1 , arr + 1 + n);
    int l = 0;
    int r = 1e9;
    while(l < r){
        int mid = l + r + 1 >> 1;
        if(check(mid)){
            l = mid;
        }
        else{
            r = mid - 1;
        }
    }
    printf("%d\n" , l);
}

Measured memory_bytes: 27776