#include <bits/stdc++.h>

using namespace std;

const int maxn = 10010;

int head[100010],to[5000010],nextt[5000010],tot = 1;
int pos[maxn * 2],ans,scc[100010],pre[maxn * 10],low[maxn * 10],cnt;
int dfs_clock,n,weizhi[maxn * 2];

stack<int> S;

struct node
{
    int opt,x,id;
}e[maxn * 2];

bool cmp(node a,node b)
{
    return a.x < b.x;
}

void add(int x,int y)
{
    //cout << x << " " << y << endl;
    to[tot] = y;
    nextt[tot] = head[x];
    head[x] = tot++;
}

void tarjan(int u)
{
    S.push(u);
    pre[u] = low[u] = ++dfs_clock;
    for (int i = head[u];i;i = nextt[i])
    {
        int v = to[i];
        if (!pre[v])
        {
            tarjan(v);
            low[u] = min(low[u],low[v]);
        }
        else if (!scc[v])
            low[u] = min(low[u],pre[v]);
    }
    if (low[u] == pre[u])
    {
        ++cnt;
        while (1)
        {
            int t = S.top();
            S.pop();
            scc[t] = cnt;
            if (t == u)
                break;
        }
    }
}

void build(int o,int l,int r)
{
    if (l == r)
    {
        int temp = e[l].id;
        if (e[l].opt == 1) //保存相反的节点
            temp += n;
        //cout << "叶子! " << o << " " << temp << " " << e[temp].opt << " " << l << " " << e[l].x << endl;
        pos[temp] = o;
        return;
    }
    int mid = (l + r) >> 1;
    add(o,o * 2);
    add(o,o * 2 + 1);
    build(o * 2,l,mid);
    build(o * 2 + 1,mid + 1,r);
}

void update(int o,int l,int r,int x,int y,int from)
{
    if (x > y)
        return;
    if (x <= l && r <= y)
    {
        add(from,o);
        return;
    }
    int mid = (l + r) >> 1;
    if (x <= mid)
        update(o * 2,l,mid,x,y,from);
    if (y > mid)
        update(o * 2 + 1,mid + 1,r,x,y,from);
}

bool check(int x)
{
    while (!S.empty())
        S.pop();
    memset(head,0,sizeof(head));
    memset(pre,0,sizeof(pre));
    memset(low,0,sizeof(low));
    cnt = 0;
    dfs_clock = 0;
    memset(scc,0,sizeof(scc));
    tot = 1;
    build(1,1,2 * n);
    /*
    for (int i = 1; i <= 2 * n; i++)
        cout << pos[i] << " ";
    cout << endl;
    */
    int cur = 1;
    for (int i = 1; i <= 2 * n; i++)
    {
        while (cur <= i && e[i].x - e[cur].x + 1 > x)
            cur++;
        int temp = e[i].id;
        if (e[i].opt == -1)
            temp += n;
        //cout << i << " " << cur << " " << i - 1 << endl;
        update(1,1,2 * n,cur,i - 1,pos[temp]);
    }

    cur = 2 * n;
    for (int i = 2 * n; i >= 1; i--)
    {
        while (cur >= i && e[cur].x - e[i].x + 1 > x)
            cur--;
        int temp = e[i].id;
        if (e[i].opt == -1)
            temp += n;
        update(1,1,2 * n,i + 1,cur,pos[temp]);
    }
    for (int i = 1; i <= 2 * n; i++)
        if (!pre[pos[i]])
            tarjan(pos[i]);
    for (int i = 1; i <= n; i++)
        if (scc[pos[i]] == scc[pos[i + n]])
            return false;
    return true;
}

int main()
{
    scanf("%d",&n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d%d",&e[i].x,&e[i + n].x);
        e[i].opt = 1; //x
        e[i + n].opt = -1; //y
        e[i].id = e[i + n].id = i; //记录各自的编号
    }
    sort(e + 1,e + 1 + 2 * n,cmp);  //按照坐标排序
    for (int i = 1; i <= 2 * n; i++)
    {
        int temp = e[i].id;
        if (e[i].opt == 1)
            temp += n;
        weizhi[temp] = i;
    }
    int l = 0,r = 1e9;
    while (l <= r)
    {
        int mid = (l + r) >> 1;
        if (check(mid))
        {
            ans = mid;
            l = mid + 1;
        }
        else
            r = mid - 1;
    }
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 14080