#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
#define lson rt<<1
#define rson (rt<<1)|1
const int MAXN=20010;

inline void read(int &x) {
    x=0;int f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();};
    while(isdigit(ch)){x=x*10+(ch-'0');ch=getchar();};x*=f;
}

int n,tot,sz=0;
struct flag {
    int x,id,oth,ty;
} a[MAXN],b[MAXN],c[MAXN];
int mp[MAXN][2];
int L,R,ans,ttb=0,ttc=0;
struct edge {
    int x,y,nxt;
} E[20202020];
int head[MAXN*5];
int pos[MAXN][3];

bool cmp(flag A,flag B) {
    return A.x<B.x;
}

inline void addedge(int x,int y) {
    E[++tot].x=x;
    E[tot].y=y;
    E[tot].nxt=head[x];
    head[x]=tot;
}

int dfn[MAXN*5],low[MAXN*5],stk[MAXN*5],blk[MAXN*5];
int top=0,clk=0,scccnt=0;
inline void tarjan(int x) {
    dfn[x]=low[x]=++clk;
    stk[++top]=x;
    for(int i=head[x];~i;i=E[i].nxt) {
        int to=E[i].y;
        if(!dfn[to]) {
            tarjan(to);
            low[x]=min(low[x],low[to]);
        } else if(!blk[to]) {
            low[x]=min(low[x],dfn[to]);
        }
    }
    if(low[x]==dfn[x]) {
        scccnt++;
        while(1) {
            int now=stk[top--];
            blk[now]=scccnt;
            if(now==x) break;
        }
    }
}

struct segnode {
    int l,r,u,d;
} seg[MAXN*5];
int ndcnt=0;

inline void build(int rt,int l,int r) {
    seg[rt].l=l, seg[rt].r=r;
    seg[rt].u=++ndcnt, seg[rt].d=++ndcnt;
    if(l==r) {
        addedge(a[l].id,seg[rt].u);
        addedge(seg[rt].d,a[l].oth);
        return;
    }
    int mid=(l+r)>>1;
    addedge(seg[rt].d,seg[lson].d);
    addedge(seg[rt].d,seg[rson].d);
    build(lson,l,mid);
    addedge(seg[lson].u,seg[rt].u);
    addedge(seg[rson].u,seg[rt].u);
    build(rson,mid+1,r);
}

inline void link(int rt,int l,int r,int x,int y,int id) {
    if(x<=l&&r<=y) {
        addedge(a[id].id,seg[rt].d);
        addedge(seg[rt].u,a[id].oth);
        return;
    }
    int mid=(l+r)>>1;
    if(x<=mid) link(lson,l,mid,x,y,id);
    if(mid<y) link(rson,mid+1,r,x,y,id);
}

inline void PushEdges(int v) {
    tot=0;
    build(1,1,sz);
    int st=1,en=0;
    for(int i=1;i<=sz;i++) {
        while(st<=sz&&a[i].x-a[st].x>=v) st++;
        while(en<sz&&a[en+1].x-a[i].x<v) en++;
        if(st<i) link(1,1,sz,st,i-1,i);
        if(i<en) link(1,1,sz,i+1,en,i);
    }
}

inline bool check(int v) {
    memset(head,-1,sizeof head);
    ndcnt=sz;
    PushEdges(v);
    top=clk=scccnt=0;
    memset(dfn,0,sizeof dfn);
    memset(low,0,sizeof low);
    memset(blk,0,sizeof blk);
    for(int i=1;i<=ndcnt;i++) {
        if(!dfn[i]) tarjan(i);
    }
    for(int i=1;i<=n;i++) {
        if(blk[mp[i][0]]==blk[mp[i][1]]) {
            return 0;
        }
    }
    return 1;
}

int main() {
    // freopen("A.in","r",stdin);
    // freopen("A.out","w",stdout);
    read(n);
    for(int i=1;i<=n;i++) {
        read(a[++sz].x);a[sz].id=sz;a[sz].oth=sz+1;a[sz].ty=0;
        b[i]=a[sz];
        mp[i][0]=sz;
        read(a[++sz].x);a[sz].id=sz;a[sz].oth=sz-1;a[sz].ty=1;
        c[i]=a[sz];
        mp[i][1]=sz;
    }
    sort(a+1,a+1+sz,cmp);
    L=ans=0;
    R=a[sz].x;
    while(L<=R) {
        int mid=(L+R)>>1;
        if(check(mid)) {
            ans=mid;
            L=mid+1;
        } else {
            R=mid-1;
        }
    }
    printf("%d\n",ans);
    // fclose(stdin);
    // fclose(stdout);
    return 0;
}

Measured memory_bytes: 26368