#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;

typedef pair<int, int> p;

namespace SCC{
    vector<int> g[1 << 17], r[1 << 17], dfn;
    int chk[1 << 17], pv;
    void dfs(int v){
        chk[v] = 1;
        for(auto i : g[v]){
            if(!chk[i]) dfs(i);
        }
        dfn.push_back(v);
    }
    void rdfs(int v, int color){
        chk[v] = color;
        for(auto i : r[v]){
            if(!chk[i]) rdfs(i, color);
        }
    }
    void getSCC(int n){
        memset(chk, 0, sizeof chk); dfn.clear();
        for(int i=0; i<n; i++) if(!chk[i]) dfs(i);
        memset(chk, 0, sizeof chk); pv = 0; reverse(all(dfn));
        for(auto i : dfn) if(!chk[i]) rdfs(i, ++pv);
    }
    void init(){
        for(int i=0; i<(1 << 17); i++){
            g[i].clear(), r[i].clear();
        }
    }
    void addEdge(int s, int e){
        g[s].push_back(e); r[e].push_back(s);
    }
};
using namespace SCC;

const int sz = 1 << 16, inv = 1 << 15;
int n, x[101010], y[101010], id[101010][2];
vector<p> pt;

void connect(int now, int l, int r, int node = 1, int s = 0, int e = sz-1){
    if(l > r) return;
    if(r < s || e < l) return;
    if(l <= s && e <= r){
        addEdge(now, node); return;
    }
    int m = s + e >> 1;
    connect(now, l, r, node << 1, s, m);
    connect(now, l, r, node << 1 | 1, m+1, e);
}

int solve(int m){
    init();
    for(int i=1; i<(1 << 16); i++){
        addEdge(i, i << 1);
        addEdge(i, i << 1 | 1);
    }
    for(int i=0; i<n; i++){
        addEdge(id[i][0] | sz | inv, id[i][1] | sz);
        addEdge(id[i][1] | sz | inv, id[i][0] | sz);
    }
    for(int i=0; i<n; i++){
        int a = lower_bound(all(pt), p(x[i]-m+1, -1)) - pt.begin();
        int b = upper_bound(all(pt), p(x[i]+m, -1)) - pt.begin() - 1;
        connect(id[i][0] | sz, a | inv, id[i][0] - 1 | inv);
        connect(id[i][0] | sz, id[i][0] + 1 | inv, b | inv);
        a = lower_bound(all(pt), p(y[i]-m+1, -1)) - pt.begin();
        b = upper_bound(all(pt), p(y[i]+m, -1)) - pt.begin() - 1;
        connect(id[i][1] | sz, a | inv, id[i][1] - 1 | inv);
        connect(id[i][1] | sz, id[i][1] + 1 | inv, b | inv);
    }
    getSCC(1 << 17);
    for(int i=0; i<inv; i++) if(chk[i | sz] == chk[i | sz | inv]) return 0;
    return 1;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x[i] >> y[i];
        if(x[i] > y[i]) swap(x[i], y[i]);
        pt.push_back({x[i], i});
        pt.push_back({y[i], i+n});
    }
    sort(all(pt));
    for(int i=0; i<n; i++){
        id[i][0] = lower_bound(all(pt), p(x[i], i)) - pt.begin();
        id[i][1] = lower_bound(all(pt), p(y[i], i+n)) - pt.begin();
    }
    int l = 0, r = 1e9+7;
    while(l < r){
        int m = l + r + 1 >> 1;
        if(solve(m)) l = m;
        else r = m - 1;
    }
    cout << l;
}