#include <bits/stdc++.h>

using namespace std;

//#define FILE_IO

const int NMAX = 1e4 + 5;
const int MMAX = 2e5 + 5;

int N, M;
int pos[2 * NMAX], ord[2 * NMAX];
int node[8 * NMAX];

class SAT2
{
public:
    int N;
    vector<int> edg[MMAX], redg[MMAX];
    int K, ord[MMAX];
    int f[MMAX];

    int rev(int x) { return x > N ? x - N : x + N; }
    int get(int x) { return x < 0 ? -x + N : x; }

    void init(int _N)
    {
        N = _N;
        for(int i = 1; i <= 2 * N; i++) edg[i].clear(), redg[i].clear();
    }

    void addEdge(int x, int y)
    {
        edg[x].push_back(y);
        redg[y].push_back(x);
    }

    void addCondition(int x, int y)
    {
        x = get(x); y = get(y);
        addEdge(x, y);
        addEdge( rev(y), rev(x) );
    }

    void DFS(int nod)
    {
        if(f[nod])  return;
        f[nod] = 1;
        for(auto nxt: edg[nod])
            DFS(nxt);
        ord[++K] = nod;
    }

    void DFS2(int nod)
    {
        if(f[nod])  return;
        f[nod] = K;
        for(auto nxt: redg[nod])
            DFS2(nxt);
    }

    void printGraph()
    {
        for(int i = 1; i <= 2 * N; i++)
            for(auto x: edg[i])
                printf("%d %d\n", i, x);
    }

    bool solve()
    {
        for(int i = 1; i <= 2 * N; i++) f[i] = 0;

        K = 0;
        for(int i = 1; i <= 2 * N; i++)
            if(!f[i])
                DFS(i);

        for(int i = 1; i <= 2 * N; i++) f[i] = 0;
        reverse(ord + 1, ord + K + 1);

        K = 0;
        for(int i = 1; i <= 2 * N; i++)
            if(!f[ ord[i] ])
                K++, DFS2(ord[i]);

        for(int i = 1; i <= N; i++)
            if(f[i] == f[i + N])
                return false;

        return true;
    }
}sat;

void B(int nod, int st, int dr)
{
    node[nod] = ++M;
    if(st == dr)    return;

    int mij = st + (dr - st) / 2;
    B(nod * 2, st, mij);
    B(nod * 2 + 1, mij + 1, dr);
}

void build(int nod, int st, int dr)
{
    for(int i = st; i <= dr; i++)
        sat.addCondition(node[nod], -ord[i]);

    if(st == dr)    return;

    int mij = st + (dr - st) / 2;
    build(nod * 2, st, mij);
    build(nod * 2 + 1, mij + 1, dr);
}

void U(int nod, int st, int dr, int sti, int dri, int pos)
{
    if(sti > dri)   return;
    if(sti <= st && dr <= dri)
    {
        sat.addCondition(pos, node[nod]);
        return;
    }

    int mij = st + (dr - st) / 2;
    if(sti <= mij)  U(nod * 2, st, mij, sti, dri, pos);
    if(mij < dri)   U(nod * 2 + 1, mij + 1, dr, sti, dri, pos);
}

bool can(int dst)
{
    sat.init(M);
    for(int i = 1; i <= 2 * N; i += 2)
    {
        sat.addCondition(i, -(i + 1));
        sat.addCondition(-(i + 1), i);
    }

    build(1, 1, 2 * N);

    int dr = 1;
    for(int i = 1; i <= 2 * N; i++)
    {
        dr = max(dr, i + 1);
        while(dr <= 2 * N && pos[ ord[dr] ] - pos[ ord[i] ] < dst)  dr++;
        //for(int j = i + 1; j < dr; j++)    sat.addCondition(ord[i], -ord[j]);
        U(1, 1, 2 * N, i + 1, dr - 1, ord[i]);
    }

    return sat.solve();
}

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        pos[++M] = x; pos[++M] = y;
    }

    for(int i = 1; i <= M; i++) ord[i] = i;
    sort(ord + 1, ord + M + 1,
         [](int a, int b) { return pos[a] < pos[b]; });

    B(1, 1, 2 * N);

    int p = 1;
    int u = int(1e9);
    int ans = 0;
    while(p <= u)
    {
        int mij = p + (u - p) / 2;

        if( can(mij) )
        {
            ans = mij;
            p = mij + 1;
        }
        else
            u = mij - 1;
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 37760