#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 20000
using namespace std;
inline int read()
{
    int x=0;char ch=getchar();
    while (ch<'0'||ch>'9')ch=getchar();
    while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
struct Tree{int l,r;}T[MN*4+5];
int n,a[MN+5],b[MN+5],cnt,id,top,head[MN*5+5],dfn[MN*5+5],low[MN*5+5],cc,dn,bel[MN*5+5],mx,inq[MN*5+5],Q[MN*5+5],Top;
pair<int,int> q[MN+5];
struct edge{int to,next;}e[MN*100+5];
inline void ins(int f,int t){e[++cnt]=(edge){t,head[f]};head[f]=cnt;}
int Build(int l,int r)
{
    int x=++id;
    if(l==r) return mx=max(mx,x+n*2),ins(x+n*2,(q[l].second+n-1)%(n*2)+1),x;
    int mid=l+r>>1;
    ins(x+n*2,(T[x].l=Build(l,mid))+n*2);ins(x+n*2,(T[x].r=Build(mid+1,r))+n*2);
    return x;
}
void Ins(int x,int lt,int rt,int l,int r,int v)
{
    if(lt==l&&r==rt) return ins(v,x+n*2);
    int mid=lt+rt>>1;
    if(r<=mid) Ins(T[x].l,lt,mid,l,r,v);
    else if(l>mid) Ins(T[x].r,mid+1,rt,l,r,v);
    else Ins(T[x].l,lt,mid,l,mid,v),Ins(T[x].r,mid+1,rt,mid+1,r,v);
}
void Tarjan(int x)
{
    dfn[x]=low[x]=++dn;Q[++Top]=x;inq[x]=1;
    for(int i=head[x];i;i=e[i].next)
        if(!dfn[e[i].to]) Tarjan(e[i].to),low[x]=min(low[x],low[e[i].to]);
        else if(inq[e[i].to]) low[x]=min(low[x],dfn[e[i].to]);
    if(low[x]==dfn[x])
        for(++cc,Q[Top+1]=0;Q[Top+1]!=x;--Top) inq[Q[Top]]=0,bel[Q[Top]]=cc;
}
int main()
{
    n=read();
    for(int i=1;i<=n;++i) a[i]=read(),b[i]=read(),q[++top]=make_pair(a[i],i),q[++top]=make_pair(b[i],i+n);
    sort(q+1,q+top+1);
    int l=1,r=1e9/(n-1)+2,mid,res=0;
    while(l<=r)
    {
        mid=l+r>>1;cnt=id=0;memset(head,0,sizeof(head));Build(1,n*2);
        for(int i=1;i<=n;++i)
        {
            int p=lower_bound(q+1,q+top+1,make_pair(a[i],i))-q,
                l=lower_bound(q+1,q+top+1,make_pair(a[i]-mid+1,0))-q,
                r=lower_bound(q+1,q+top+1,make_pair(a[i]+mid,0))-q-1;
            if(l<p) Ins(1,1,n*2,l,p-1,i);
            if(p<r) Ins(1,1,n*2,p+1,r,i);
            int P=lower_bound(q+1,q+top+1,make_pair(b[i],i+n))-q,
                L=lower_bound(q+1,q+top+1,make_pair(b[i]-mid+1,0))-q,
                R=lower_bound(q+1,q+top+1,make_pair(b[i]+mid,0))-q-1;
            if(L<P) Ins(1,1,n*2,L,P-1,i+n);
            if(P<R) Ins(1,1,n*2,P+1,R,i+n);
        }
        memset(dfn,0,sizeof(dfn));memset(low,0,sizeof(low));dn=cc=0;
        for(int i=1;i<=mx;++i) if(!dfn[i]) Tarjan(i);
        int flag=1;
        for(int i=1;i<=n;++i) if(bel[i]==bel[i+n]) flag=0;
        if(flag) res=mid,l=mid+1; else r=mid-1;
    }
    printf("%d",res);
    return 0;
}
