///usr/bin/g++ -O2 -std=c++14 -DTr___ $0 -o $0.run; exec $0.run; exit
#include <bits/stdc++.h>
#define llint long long
#define fi first
#define se second
#define BIT(x, i) (((x)>>(i))&1ll)
#define MASK(i) (1ll<<(i))
#define db(x) cout << #x << " = " << (x) << endl;
#define dbs(x, y) cout << x << " " << y << endl;
#define mini(x, y) ((x)>(y)?(x)=(y),1:0)
#define maxi(x, y) ((x)<(y)?(x)=(y),1:0)
using namespace std;

void openFile() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef Tr___
    freopen("../test.inp", "r", stdin);
    freopen("../test.out", "w", stdout);
#else
    //freopen("tname.inp", "r", stdin);
    //freopen("tname.out", "w", stdout);
#endif
}

const int maxn = (int) 5e5 + 5;
const int maxm = (int) 1e6 + 5;
const llint inf = (llint) 1e9 + 7;

int N;
vector<int> ver[maxn];
vector<int> rev[maxn];
struct state {
    int x, y;

    bool operator<(const state &o) const {
        return x < o.x;
    }
} a[maxn];
vector<int> all;
vector<int> apos[maxn];

void enter() {
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        cin >> a[i].x;
        a[i].y = i;
        cin >> a[i + N].x;
        a[i + N].y = i;
        all.push_back(a[i].x); all.push_back(a[i + N].x);
    }
    sort(a + 1, a + N * 2 + 1);
    for (int i = 1; i <= N * 2; ++i) {
        apos[a[i].y].push_back(i);
//        db(a[i].x);
//        db(a[i].y);
//        db(i);
    }
    for (int i = 1; i <= N * 2; ++i) {
        a[i].y = apos[a[i].y][0] ^ apos[a[i].y][1] ^ i;
//        db(a[i].x);
//        db(a[i].y);
    }
    N *= 2;
}

int it[maxn * 4], L[maxn * 4], R[maxn * 4];
int nid = 0;
int pos[maxn];

inline int neg(int x) {
    return x <= N + nid ? x + N + nid : x - N - nid;
}

void buildTree(int x, int low, int high) {
    L[x] = low; R[x] = high;
    if (low == high) {
        it[x] = low;
        return;
    }
    int mid = (low + high) / 2;
    buildTree(x<<1, low, mid);
    buildTree(x<<1|1, mid + 1, high);
    ++nid;
    it[x] = N + nid;
    pos[it[x]] = x;
}

void createNode(int x, int low, int high, int p) {
    if (L[x] > high || R[x] < low) return;
    if (low <= L[x] && R[x] <= high) {
        if (L[x] == R[x]) {
            ver[p].push_back(neg(it[x]));
            rev[neg(it[x])].push_back(p);
        }
        else {
            ver[p].push_back(it[x]);
            rev[it[x]].push_back(p);
        }
        return;
    }
    createNode(x<<1, low, high, p);
    createNode(x<<1|1, low, high, p);
}

void buildEdge() {
    for (int i = 1; i <= (N + nid) * 2; ++i) {
        ver[i].clear();
        rev[i].clear();
    }

    // x -> not y
    // not x -> y
    // y -> not x
    // not y -> x

    for (int i = 1; i <= N; ++i) {
        ver[i].push_back(neg(a[i].y));
        rev[neg(a[i].y)].push_back(i);
//        dbs(i, neg(a[i].y));
        ver[neg(i)].push_back(a[i].y);
        rev[a[i].y].push_back(neg(i));
//        dbs(neg(i), a[i].y);
    }

    for (int i = N + 1; i <= N + nid; ++i) {
        int x = pos[i];
        int lef = L[x], rig = R[x];
        for (int j = lef; j <= rig; ++j) {
            ver[i].push_back(neg(j));
            rev[neg(j)].push_back(i);
        }
    }
}

bool vis[maxn];
int scc[maxn];
vector<int> st;

void dfs(int u) {
    vis[u] = true;
    for (int v : ver[u]) {
        if (!vis[v]) {
            dfs(v);
        }
    }
    st.push_back(u);
}

void sfd(int u, int cnt) {
    vis[u] = true;
    scc[u] = cnt;
    for (int v : rev[u]) {
        if (!vis[v]) {
            sfd(v, cnt);
        }
    }
}

bool check(int distance) {
    buildEdge();
//    db(N + nid);
//    for (int i = 1; i <= N; ++i) {
//        cout << a[i].x << " ";
//    }
//    cout << endl;

    for (int i = 1; i <= N; ++i) {
        int lef = lower_bound(all.begin(), all.end(), a[i].x - distance) - all.begin() + 1;
        int rig = upper_bound(all.begin(), all.end(), a[i].x + distance) - all.begin();
//        db(a[i].x);
//        db(lef); db(rig);
        createNode(1, lef, i - 1, i);
        createNode(1, i + 1, rig, i);
    }

    st.clear();
    fill_n(vis, maxn, 0);
    for (int i = 1; i <= N; ++i) {
        if (!vis[i]) {
            dfs(i);
        }
        if (!vis[neg(i)]) {
            dfs(neg(i));
        }
    }
    fill_n(vis, maxn, 0);
    int cnt = 0;
    while (!st.empty()) {
        int x = st.back(); st.pop_back();
        if (!vis[x]) {
            sfd(x, ++cnt);
        }
    }

    for (int i = 1; i <= N; ++i) {
        if (scc[i] == scc[neg(i)]) {
//            db(a[i].x); db(a[i].y);
            return false;
        }
    }
    return true;
}

void solve() {
    sort(all.begin(), all.end());
    buildTree(1, 1, N);

    int low = 0, high = 1000 * 1000 * 1000, mid;
    while (low <= high) {
        mid = (low + high) / 2;
        if (!check(mid)) {
            high = mid - 1;
        }
        else {
            low = mid + 1;
        }
    }
    cout << low << endl;
}

int main() {
    openFile();
    enter();
    solve();
    return 0;
}

Measured memory_bytes: 71040