#include <bits/stdc++.h>
using namespace std;

const int N = 10010 , M = 100010 , T = 1000010;

int n , x[N] , y[N];
int tot;
pair<int,int> val[N * 2];

inline int read() {
    int x = 0 ; char c = getchar(); bool f = 0;
    while(c < '0' || c > '9') f |= (c=='-') , c = getchar();
    while(c >= '0' && c <= '9') x = x * 10 + (c^48) , c = getchar();
    return f ? -x : x;
}

int node[M] , cnt;
void init() {
    n = read();
    for(int i = 1 ; i <= n ; ++i) {
        x[i] = read() , y[i] = read();
        val[++tot] = make_pair(x[i] , i) , val[++tot] = make_pair(y[i] , -i);
    }
    sort(val + 1 , val + 1 + tot);
    for(int i = 1 ; i <= n ; ++i) {
        x[i] = lower_bound(val + 1 , val + 1 + tot , make_pair(x[i] , i)) - val;
        y[i] = lower_bound(val + 1 , val + 1 + tot , make_pair(y[i] , -i)) - val;
    }
}

int head[M] , to[T] , nxt[T] , cnte;
void addedge(int x , int y) {
    to[++cnte] = y;
    nxt[cnte] = head[x];
    head[x] = cnte;
}

void build(int x , int l , int r) {
    node[x] = ++cnt;
    if(l == r) return ;
    int mid = (l + r) >> 1;
    build(x << 1 , l , mid) , build(x << 1 | 1 , mid + 1 , r);
    addedge(node[x] , node[x << 1]) , addedge(node[x] , node[x << 1 | 1]);
}

void adde(int pos , int to) {
    int l = 1 , r = tot , x = 1;
    while(l < r) {
        int mid = (l + r) >> 1;
        if(pos <= mid) r = mid , x = x << 1;
        else l = mid + 1 , x = x << 1 | 1;
    }
    addedge(node[x] , to);
}

void adde(int x , int l , int r , int ql , int qr , int from) {
    if(ql <= l && r <= qr) return addedge(from , node[x]);
    int mid = (l + r) >> 1;
    if(ql <= mid) adde(x<<1 , l , mid , ql , qr , from);
    if(qr > mid) adde(x<<1|1 , mid + 1 , r , ql , qr , from);
}

int dfn[M] , low[M] , col[M] , _clock , _cnt;
int stk[M] , top , ins[M];

void tarjan(int x) {
    stk[++top] = x , ins[x] = 1;
    dfn[x] = low[x] = ++_clock;
    for(int i = head[x] ; i ; i = nxt[i]) {
        int y = to[i];
        if(!dfn[y]) {
            tarjan(y);
            low[x] = min(low[x] , low[y]);
        } else if(ins[y]) 
            low[x] = min(low[x] , dfn[y]);
    }
    if(low[x] == dfn[x]) {
        _cnt++;
        int node;
        do {
            node = stk[top--];
            ins[node] = 0;
            col[node] = _cnt;
        }while(node != x);
    }
}

void getLR(int &l , int &r , int pos , int d) {
    l = lower_bound(val + 1 , val + 1 + tot , make_pair(val[pos].first - d , -998244353)) - val;
    r = upper_bound(val + 1 , val + 1 + tot , make_pair(val[pos].first + d , 998244353)) - 1 - val; 
}

bool check(int d) {
    cnt = 2*n;
    memset(head , 0 , sizeof(head));
    cnte = 0;
    memset(dfn , 0 , sizeof(dfn));
    memset(low , 0 , sizeof(low));
    top = 0;
    memset(ins , 0 , sizeof(ins));

    build(1 , 1 , tot);
    for(int i = 1 ; i <= n ; ++i) 
        adde(x[i] , i + n) , adde(y[i] , i);
    for(int i = 1 , l , r; i <= n ; ++i) {
        getLR(l , r , x[i] , d);
        if(r > x[i]) adde(1 , 1 , tot , x[i] + 1 , r , i);
        if(x[i] > l) adde(1 , 1 , tot , l , x[i] - 1 , i);
        getLR(l , r , y[i] , d);
        if(r > y[i]) adde(1 , 1 , tot , y[i] + 1 , r , i + n);
        if(y[i] > l) adde(1 , 1 , tot , l , y[i] - 1 , i + n);
    }
    for(int i = 1 ; i <= cnt ; ++i) if(!dfn[i]) tarjan(i);
    for(int i = 1 ; i <= n ; ++i) if(col[i] == col[i + n]) return false;
    return true;
}

int main() {
    init();
    if(!check(0)) return puts("0") & 0;
    int l = 0 , r = val[tot].first - val[1].first , mid;
    while(l < r) {
        mid = (l + r + 1) >> 1;
        if(check(mid)) l = mid;
        else r = mid - 1;
    }
    printf("%d\n" , l + 1);
}

Measured memory_bytes: 13440