#include <bits/stdc++.h>
#define L long long

using namespace std;


struct S{
	L loc,Wkr;
}a[400010];
bool operator<(S a,S b){
	if(a.loc!=b.loc) return a.loc<b.loc;
	return a.Wkr<b.Wkr;
}

map<S,S>mp;

L tr1[400040],tr2[400040];
L link[400020];
L n;
vector<L>v[400010],w[400010];

L belong[400010];
L chk[400010];
L ord[400010];
L ordtop;
L invord[400010];
L scctop;

void dfs1(L x){
	L i;
	for(i=0;i<v[x].size();i++)
	{
		if(!chk[v[x][i]])
		{
			chk[v[x][i]]=1;
			dfs1(v[x][i]);
		}
	}
	invord[++ordtop]=x;
}

void dfs2(L x){
	L i;
	belong[x]=scctop;
	for(i=0;i<w[x].size();i++)
	{
		if(!chk[w[x][i]])
		{
			chk[w[x][i]]=1;
			dfs2(w[x][i]);
		}
	}
}

void scc(){
	L i;
	for(i=1;i<=18*n;i++)
	{
		chk[i]=belong[i]=ord[i]=invord[i]=ordtop=scctop=0;
	}
	for(i=1;i<=18*n;i++)
	{
		if(!chk[i])
		{
			chk[i]=1;
			dfs1(i);
		}
	}
	for(i=1;i<=18*n;i++) chk[i]=0;
	for(i=18*n;i>=1;i--)
	{
		if(!chk[invord[i]])
		{
			chk[invord[i]]=1;
			scctop++;
			dfs2(invord[i]);
		}
	}
}

void init(L now,L s,L e){
	if(s==e)
	{
		//v[16*n+s].push_back(now);
		v[now+8*n].push_back(16*n+link[s]);
		//w[now].push_back(16*n+s);
		w[16*n+link[s]].push_back(now+8*n);
		return;
	}
	L mid=(s+e)/2;
	//v[now*2].push_back(now);
	//v[now*2+1].push_back(now);
	v[now+8*n].push_back(now*2+8*n);
	v[now+8*n].push_back(now*2+1+8*n);
	//w[now].push_back(now*2);
	//w[now].push_back(now*2+1);
	w[now*2+8*n].push_back(now+8*n);
	w[now*2+1+8*n].push_back(now+8*n);
	init(now*2,s,mid);
	init(now*2+1,mid+1,e);
}

void go(L now,L S,L E,L s,L e,bool popping,L start){
	if(s>e) return;
	if(S>e||E<s) return;
	if(s<=S&&E<=e)
	{
		if(popping)
		{
			while(v[start].size()!=0)
			{
				//printf("wow %lld\n",v[start].size());
				v[start].pop_back();
			}
			while(w[now+8*n].size()!=(now==1?0:1)) 
			{
				//printf("wowwow %lld\n",w[now+8*n].size());
				w[now+8*n].pop_back();
			}
		}
		else
		{
			//printf("link %lld %lld\n",start,now+8*n);
			v[start].push_back(now+8*n);
			w[now+8*n].push_back(start);
		}
		return;
	}
	L mid=(S+E)/2;
	go(now*2,S,mid,s,e,popping,start);
	go(now*2+1,mid+1,E,s,e,popping,start);

}
bool ok(L x){
	//x=1;
	//printf("\n%lld\n",x);
	L i,s=1,e=1,ret=1;
	for(i=1;i<=2*n;i++)
	{
		while(s<i&&a[s].loc<=a[i].loc-x) s++;
		while(e<2*n&&a[e+1].loc<a[i].loc+x) e++;
		//printf("%lld %lld %lld\n",s,i,e);
		go(1,1,2*n,s,i-1,0,i+16*n);
		//printf("%lld %lld %lld\n",s,i,e);
		go(1,1,2*n,i+1,e,0,i+16*n);
	}
	//puts("");
	/*for(i=8*n+1;i<=18*n;i++)
	{
		printf("%lld %lld\n",i,v[i].size());
		for(L j=0;j<v[i].size();j++)
		{
			printf("%lld ",v[i][j]);
		}
		puts("");
	}*/
	//puts("");
	scc();
	for(i=1;i<=2*n;i++)
	{
		//printf("%lld ",belong[i+16*n]);
		if(belong[i+16*n]==belong[link[i]+16*n]) ret=0;
	}
	//puts("");
	s=1,e=1;
	for(i=1;i<=2*n;i++)
	{
		while(s<i&&a[s].loc<a[i].loc-x) s++;
		while(e<2*n&&a[e+1].loc<=a[i].loc+x) e++;
		go(1,1,2*n,s,i-1,1,i+16*n);
		go(1,1,2*n,i+1,e,1,i+16*n);
	}
	return ret;
}

int main()
{
	scanf("%lld",&n);
	L i;
	for(i=1;i<=n;i++)
	{
		L s,e;
		scanf("%lld %lld",&s,&e);
		a[i*2-1]=(S){s,i*2-1};
		a[i*2]=(S){e,i*2};
		mp[a[i*2-1]]=a[i*2];
		mp[a[i*2]]=a[i*2-1];
	}
	sort(a+1,a+2*n+1);
	for(i=1;i<=2*n;i++)
	{
		link[i]=lower_bound(a+1,a+2*n+1,mp[a[i]])-a;
	}
	init(1,1,2*n);
	L s=0,e=1000000000;
	while(s<e)
	{
		L mid=(s+e+1)/2;
		if(ok(mid))
			s=mid;
		else
			e=mid-1;
	}
	printf("%lld\n",s);
}

Measured memory_bytes: 64868