#include<bits/stdc++.h>
#define mid (l+r>>1)
#define ls (o<<1)
#define rs (o<<1|1)
using namespace std;
const int N=2e6;
int n,m,a[N],c[N],tot,cnt,fir[N],nxt[N],to[N],b[N],seg[N],dfn[N],low[N],tim,sy[N],scc,st[N],tt,vis[N];
int cmp(int x,int y)
{
	return a[x]<a[y];
}
int op;
void add(int u,int v)
{//if(op==1)cout<<u<<" "<<v<<endl;
	to[++cnt]=v,nxt[cnt]=fir[u],fir[u]=cnt;
}
void bt(int l,int r,int o)
{
	if(l==r){seg[b[l]]=o;return;}
	bt(l,mid,ls),bt(mid+1,r,rs),
	add(o,ls),add(o,rs);
}
int siz,lc[N],rc[N];
int bit(int l,int r)
{int x=++siz;
	if(l==r)return seg[c[l]];op=1;
	add(x,lc[x]=bit(l,mid)),add(x,rc[x]=bit(mid+1,r));op=0;
	return x;
}
void chng(int l,int r,int o,int u,int x,int y)
{
	if(l>=x&&r<=y)
	{//cout<<u<<" "<<l<<" "<<r<<endl;
		add(u,o);return;
	}
	if(mid>=x)chng(l,mid,ls,u,x,y);
	if(mid+1<=y)chng(mid+1,r,rs,u,x,y);
}
void ching(int l,int r,int o,int u,int x,int y)
{//cout<<l<<" "<<r<<endl;
	if(l>=x&&r<=y)
	{//cout<<u<<" "<<l<<" "<<r<<endl;
		add(o,u);return;
	}
	if(mid>=x)ching(l,mid,lc[o],u,x,y);
	if(mid+1<=y)ching(mid+1,r,rc[o],u,x,y);
}
void dfs(int x)
{
	dfn[x]=low[x]=++tim;st[++tt]=x;vis[x]=1;
	for(int i=fir[x];i;i=nxt[i])
	{
		if(dfn[to[i]])
		{
			low[x]=min(low[x],dfn[to[i]]);
		}
		else if(!vis[to[i]])
		dfs(to[i]),low[x]=min(low[x],low[to[i]]);
	}
	if(dfn[x]==low[x])
	{
		scc++;//cout<<st[tt]<<" "<<scc<<endl;
		for(sy[st[tt]]=scc;st[tt]!=x;tt--,sy[st[tt]]=scc)continue;
		tt--;
	}
}
int pd(int x)
{cnt=0;
	memset(fir,0,sizeof(fir));bt(1,tot,1);siz=tot*4+2;int rt=bit(1,tot);
	int l=1,r=1;
	for(int i=1;i<=tot;i++)
	{
		while(abs(a[c[i]]-a[c[r]])<x&&r<=tot)r++;
		while(abs(a[c[i]]-a[c[l]])>=x&&l<=tot)l++;//cout<<i<<" "<<l<<" "<<r<<endl;//cout<<c[i]<<" "<<a[c[i]]<<" "<<c[r]<<" "<<a[c[r]]<<endl;
		if(l<i)chng(1,tot,1,seg[c[i]],l,i-1),ching(1,tot,rt,seg[b[i]],l,i-1);
		if(i<r-1)chng(1,tot,1,seg[c[i]],i+1,r-1),ching(1,tot,rt,seg[b[i]],i+1,r-1);
		//for(int j=l;j<r;j++)
		//if(j!=i)add(seg[c[j]],seg[b[i]]);
	}scc=tim=tt=0;
	for(int i=1;i<=tot*8+10;i++)dfn[i]=sy[i]=vis[i]=0;
	for(int i=1;i<=tot*8+10;i++)if(!dfn[i])dfs(i);
	for(int i=1;i<=tot;i++)
	{//cout<<seg[b[i]]<<" "<<sy[seg[b[i]]]<<" "<<seg[b[i]+n]<<" "<<sy[seg[b[i]+n]]<<endl;
		if(b[i]<=n)
		{
			if(sy[seg[b[i]]]==sy[seg[b[i]+n]])return 0;
		}
		else 
		if(sy[seg[b[i]]]==sy[seg[b[i]-n]])return 0;
	}
	return 1;
}
int pp(int x)
{
	memset(fir,0,sizeof(fir));bt(1,tot,1);//bit(1,tot,1);
	int l=1,r=1;memset(vis,0,sizeof(vis));memset(dfn,0,sizeof(dfn));memset(sy,0,sizeof(sy));
	for(int i=1;i<=tot;i++)
	{
		while(abs(a[c[i]]-a[c[r]])<x&&r<=tot)r++;
		while(abs(a[c[i]]-a[c[l]])>=x&&l<=tot)l++;//cout<<i<<" "<<l<<" "<<r<<endl;//cout<<c[i]<<" "<<a[c[i]]<<" "<<c[r]<<" "<<a[c[r]]<<endl;
		if(l<i)chng(1,tot,1,seg[c[i]],l,i-1);//,ching(1,tot,1,seg[b[i]],l,i-1);
		if(i<r-1)chng(1,tot,1,seg[c[i]],i+1,r-1);//,ching(1,tot,1,seg[b[i]],i+1,r-1);
		for(int j=l;j<r;j++)
		if(j!=i)add(seg[c[j]],seg[b[i]]);
	}scc=tim=tt=0;;
	for(int i=1;i<=tot*4;i++)if(!dfn[i])dfs(i);//return 0;
	for(int i=1;i<=tot;i++)
	{//cout<<seg[b[i]]<<" "<<sy[seg[b[i]]]<<" "<<seg[b[i]+n]<<" "<<sy[seg[b[i]+n]]<<endl;
		if(b[i]<=n)
		{
			if(sy[seg[b[i]]]==sy[seg[b[i]+n]])return 0;
		}
		else 
		if(sy[seg[b[i]]]==sy[seg[b[i]-n]])return 0;
	}
	return 1;
}
int main()
{
	//freopen("18.in","r",stdin);
	//freopen("flags.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i],&a[i+n]);
		//a[i]=rand()%(int)1e9+1,a[i+n]=rand()%(int)1e9+1;a[i]++;a[i+n]++;
		c[++tot]=i,c[++tot]=i+n;
	}//cout<<tot<<endl;return 0;
	sort(c+1,c+tot+1,cmp);
	for(int i=1;i<=tot;i++)
	{
		int x=c[i];
		if(x<=n)
		{
			b[i]=x+n;
		}else b[i]=x-n;
	}
	int l=0,r=1e9;
	while(l<r)
	{//cout<<l<<" "<<r<<endl;
		if(pd(mid))l=mid+1;
		else r=mid;
	}
	cout<<r-1<<endl;return 0;
	l=0,r=1e9;
	while(l<r)
	{
		if(pp(mid))l=mid+1;else r=mid;
	}cout<<r-1<<endl;
}