#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;

using P = pair<int, int>;
const int MN = 42424;
int n;
V<int> g[MN];
V<P> cs;
int x[MN][2], r[MN][2];
int leaf[MN];
VV<int> groups;
int ord[MN], low[MN], tim;
int id[MN];
V<int> st;

void build(int x, int lw, int up) {
    if (up - lw == 1) {
        leaf[lw] = x;
        return;
    }
    int md = (lw + up) / 2;
    int y = x + 2 * (md - lw);
    g[x].push_back(x + 1);
    g[x].push_back(y);
    build(x + 1, lw, md);
    build(y, md, up);
}

void link(int x, int sz, int a, int b, int c) {
    if (b <= 0 || sz <= a) return;
    if (a <= 0 && sz <= b) {
        g[c].push_back(x);
        return;
    }
    int y = x + 2 * (sz / 2);
    link(x + 1, sz / 2, a, b, c);
    link(y, sz - sz / 2, a - sz / 2, b - sz / 2, c);
}

void dfs(int v) {
    st.push_back(v);
    ord[v] = low[v] = tim++;
    for (int u: g[v]) {
        if (ord[u] == -1) {
            dfs(u);
            low[v] = min(low[v], low[u]);
        } else if (id[u] == -1) {
            low[v] = min(low[v], ord[u]);
        }
    }
    if (ord[v] == low[v]) {
        V<int> gr;
        while (true) {
            int u = st.back();
            st.pop_back();
            gr.push_back(u);
            id[u] = int(groups.size());
            if (u == v) break;
        }
        groups.push_back(gr);
    }
}

bool check(int md) {
    for (int i = 0; i < 4 * n - 1; i++) {
        g[i].clear();
    }
    build(0, 0, 2 * n);
    for (auto &p : cs) {
        int i1 = p.second / 2;
        int i2 = p.second % 2;
        int c = p.first;
        int lw = lower_bound(cs.begin(), cs.end(), P(c - md + 1, -1)) - cs.begin();
        int up = upper_bound(cs.begin(), cs.end(), P(c + md - 1, 2 * n)) - cs.begin();
        int cur = r[i1][i2];
        int alt = r[i1][1 - i2];
        if (lw <= alt && alt < up) {
            link(0, 2 * n, lw, alt, leaf[cur]);
            link(0, 2 * n, alt + 1, up, leaf[cur]);
        } else {
            link(0, 2 * n, lw, up, leaf[cur]);
        }
    }

    fill_n(id, 4 * n - 1, -1);
    fill_n(ord, 4 * n - 1, -1);
    groups.clear();
    tim = 0;
    for (int i = 0; i < 4 * n - 1; i++) {
        if (ord[i] == -1) dfs(i);
    }
    for (int i = 0; i < n; i++) {
        int i1 = id[leaf[r[i][0]]];
        int i2 = id[leaf[r[i][1]]];
        if (i1 == i2) return false;
    }

    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i][0] >> x[i][1];
        cs.push_back(P(x[i][0], 2 * i));
        cs.push_back(P(x[i][1], 2 * i + 1));
    }
    sort(cs.begin(), cs.end());
    for (int i = 0; i < n; i++) {
        r[i][1] = lower_bound(cs.begin(), cs.end(), P(x[i][0], 2 * i)) - cs.begin();
        r[i][0] = lower_bound(cs.begin(), cs.end(), P(x[i][1], 2 * i + 1)) - cs.begin();
    }

    int lw = 0, up = 1e9 + 10;
    while (up - lw > 1) {
        int md = (lw + up) / 2;
        if (check(md)) {
            lw = md;
        } else {
            up = md;
        }
    }
    cout << lw << "\n";
    return 0;
}

Measured memory_bytes: 12504