#include<bits/stdc++.h>

using namespace std;

const int MAXN = 10005;
const int INF = 1000000007;

int n, ofs = 1;
int x[MAXN], y[MAXN], bio[8*MAXN], comp[8*MAXN];
vector < pair <int, int> > p;
vector <int> v[8*MAXN], r[8*MAXN], st;

void update (int x, int from, int to, int low, int high, int node) {
    if (from <= low && high <= to) {
        if (x >= ofs) x = p[x - ofs].second;
        v[node].push_back(x);
        return;
    }
    if (to < low || high < from) return;
    update(2*x, from, to, low, (low+high)/2, node);
    update(2*x+1, from, to, (low+high)/2+1, high, node);
}

void edge (int node, int pos, int d, int ind) {
    int lef = lower_bound(p.begin(), p.end(), make_pair(pos-d, 0)) - p.begin();
    int rig = upper_bound(p.begin(), p.end(), make_pair(pos+d, INF)) - p.begin() - 1;
    ind = lower_bound(p.begin(), p.end(), make_pair(pos, ind)) - p.begin();
    //cout << "pos " << node << " " << ind << endl;
    if (0 <= lef && lef < 2*n && 0 <= rig && rig < 2*n && lef <= rig) {
        //cout << "edge " << node << "  " << lef << " " << rig << endl;
        if (lef <= ind-1) update(1, lef, ind-1, 0, ofs-1, node);
        if (ind+1 <= rig) update(1, ind+1, rig, 0, ofs-1, node);
    }
}

void dfs1 (int x) {
    if (bio[x]) return;
    bio[x] = 1;
    for (int i=0; i<v[x].size(); i++) {
        dfs1(v[x] [i]);
    }
    st.push_back(x);
}

void dfs2 (int x, int col) {
    if (comp[x] != -1) return;
    comp[x] = col;
    for (int i=0; i<r[x].size(); i++) {
        dfs2(r[x] [i], col);
    }
}

bool f (int d) {
    for (int i=ofs; i<2*ofs; i++) {
        v[i].clear();
    }
    for (int i=0; i<n; i++) {
        edge(2*i + ofs, x[i], d, 2*i+1 + ofs);
        edge(2*i+1 + ofs, y[i], d, 2*i + ofs);
    }
    for (int i=0; i<2*ofs; i++) {
        r[i].clear();
    }
    for (int i=1; i<2*ofs; i++) {
        for (int j=0; j<v[i].size(); j++) {
            int sus = v[i] [j];
            r[sus].push_back(i);
        }
    }
    memset(bio, 0, sizeof bio);
    st.clear();
    for (int i=1; i<2*ofs; i++) {
        if (!bio[i]) dfs1(i);
    }
    memset(comp, -1, sizeof comp);
    int br = 0;
    for (int i=st.size()-1; i>=0; i--) {
        int x = st[i];
        if (comp[x] == -1) {
            br++;
            dfs2(x, br);
        }
    }
    /*for (int i=1; i<2*ofs; i++) {
        cout << "comp " << i << " " << comp[i] << endl;
    }*/
    for (int i=0; i<n; i++) {
        if (comp[2*i + ofs] == comp[2*i+1 + ofs]) return 0;
    }
    return 1;
}

int main () {
    cin >> n;
    while (ofs < 2*n) ofs *= 2;
    for (int i=0; i<n; i++) {
        cin >> x[i] >> y[i];
        if (x[i] > y[i]) swap(x[i], y[i]);
        p.push_back(make_pair(x[i], 2*i+1 + ofs));
        p.push_back(make_pair(y[i], 2*i + ofs));
    }
    sort(p.begin(), p.end());
    while (p.size() < ofs) p.push_back(make_pair(2*INF, 0));
    for (int i=ofs-1; i>0; i--) {
        int lef = 2*i, rig = 2*i+1;
        if (lef >= ofs) lef = p[lef - ofs].second;
        if (rig >= ofs) rig = p[rig - ofs].second;
        v[i].push_back(lef);
        v[i].push_back(rig);
    }
    if (!f(0)) {
        cout << 0;
        return 0;
    }
    int low = 0, high = INF;
    while (low < high) {
        int mid = (low + high + 1)/2;
        if (f(mid)) {
            low = mid;
        } else {
            high = mid - 1;
        }
    }
    cout << low + 1;
    return 0;
}


Measured memory_bytes: 19068