#include <cstdio>
#include <algorithm>
#include <stack>
#include <vector>
static const int MAXN = 2e4 + 3;
static const int MAXD = 1e9 + 4;
static const int MAXM = 4e6 + 10;
 
int n, x[MAXN], y[MAXN];
std::pair<int, int> p[MAXN * 2];
 
inline int pid_lb(int x) { return std::distance(&p[0], std::lower_bound(p, p + n * 2, std::make_pair(x, -1))); }
inline int pid_ub(int x) { return std::distance(&p[0], std::upper_bound(p, p + n * 2, std::make_pair(x, MAXN * 10))); }
inline int pid(int x, int id) { return std::distance(&p[0], std::lower_bound(p, p + n * 2, std::make_pair(x, id))); }
 
int m;
int head[MAXN * 6], src[MAXM], dest[MAXM], next[MAXM];
inline void add_edge(int u, int v) {
    src[m] = u; dest[m] = v; next[m] = head[u]; head[u] = m++;
}
// 1 ~ (4 * n - 1): Segment tree nodes (false; node u represents not(lch[u]) and not(rch[u]))
// (4 * n ~ 6 * n - 1): Normal nodes (true)
inline std::vector<int> get_sgt_vertices(int L, int R)
{
    std::vector<int> ret;
    if (L >= R) return ret;
    L += n * 2, R += n * 2;
    for (; L < R; L >>= 1, R >>= 1) {
        if (L & 1) ret.push_back(L++);
        if (R & 1) ret.push_back(--R);
    }
    return ret;
}
int dfn[MAXN * 6], low[MAXN * 6];
std::stack<int> stk;
bool onstack[MAXN * 6];
int epoch, scc_ct;
int scc_id[MAXN * 6];
void dfs_scc(int u)
{
    dfn[u] = low[u] = epoch++;
    stk.push(u); onstack[u] = true;
 
    for (int w = head[u]; w != -1; w = next[w]) {
        if (dfn[dest[w]] == -1) {
            dfs_scc(dest[w]);
            low[u] = std::min(low[u], low[dest[w]]);
        } else if (onstack[dest[w]]) {
            low[u] = std::min(low[u], dfn[dest[w]]);
        }
    }
 
    if (low[u] == dfn[u]) {
        int v;
        do {
            v = stk.top(); stk.pop();
            onstack[v] = false;
            scc_id[v] = scc_ct;
        } while (v != u);
        ++scc_ct;
    }
}
bool check(int d)
{
    m = 0;
    for (int i = 1; i < n * 6; ++i) head[i] = -1;
    for (int i = 1; i < n * 2; ++i) {
        add_edge(i, i * 2);
        add_edge(i, i * 2 + 1);
    }
    for (int i = 0; i < n; ++i) {
        int u = n * 4 + pid(x[i], i * 2), not_u = u - n * 2,
            v = n * 4 + pid(y[i], i * 2 + 1), not_v = v - n * 2;
        add_edge(u, not_v); add_edge(not_v, u);
        add_edge(v, not_u); add_edge(not_u, v);
    }
    for (int i = 0; i < n * 2; ++i) {
        int lb = pid_lb(p[i].first - d + 1), ub = pid_ub(p[i].first + d - 1);
        std::vector<int> verts = get_sgt_vertices(lb, i);
        for (int u : verts) add_edge(n * 4 + i, u);
        verts = get_sgt_vertices(i + 1, ub);
        for (int u : verts) add_edge(n * 4 + i, u);
    }
 
    std::fill(dfn, dfn + n * 6, -1);
    epoch = scc_ct = 0;
    for (int i = 1; i < n * 6; ++i) if (dfn[i] == -1) dfs_scc(i);
 
    for (int i = 0; i < n * 2; ++i) {
        if (scc_id[n * 4 + i] == scc_id[n * 2 + i]) return false;
    }
    return true;
}
 
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &x[i], &y[i]);
        p[i * 2] = { x[i], i * 2 };
        p[i * 2 + 1] = { y[i], i * 2 + 1 };
    }
    std::sort(p, p + n * 2);
 
    int lo = 0, hi = MAXD, mid;
    while (lo < hi - 1) {
        mid = (lo + hi) >> 1;
        if (check(mid)) lo = mid; else hi = mid;
    }
 
    printf("%d\n", lo);
    return 0;
}


Measured memory_bytes: 17664