#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define ins insert
#define rs (x<<1|1) 
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define sqr(x) ((x)*(x))
#define cle(x) ((x).clear())
#define lowbit(x) ((x)&(-x))
#define SZ(x) (int((x).size()))
#define All(x) (x).begin(),(x).end()
#define ms(x,y) memset(x,y,sizeof (x))
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)]) 
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
template<class T>inline void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
inline int getgcd(int x,int y){if(!x)return y;return getgcd(y%x,x);}
inline int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=(ll)x*x%p)if(k&1)res=(ll)res*x%p;return res;}
const double pi=acos(-1);	
inline void judge(){
	freopen("input.txt","r",stdin);
} 
//********************************head*************************************
const int maxn=4e5+5,maxm=5e6+5;
int n,m,tot,maxi,sccnum,top,ind;
int id[maxn][2];
int head[maxn],des[maxm],nxt[maxm];
int dfn[maxn],low[maxn],st[maxn],bel[maxn];
pa q[maxn];
#define T(x) ((x)<<1)
#define F(x) ((x)<<1|1)
void adde(int x,int y){
	des[++tot]=y;nxt[tot]=head[x];head[x]=tot;
}
void build(int x,int l,int r){
	maxi=max(maxi,x);
	if(l==r)return;
	build(ls,l,mid);build(rs,mid+1,r);
	adde(T(ls),T(x));adde(F(x),F(ls));
	adde(T(rs),T(x));adde(F(x),F(rs));
}
int query(int x,int l,int r,int pos){
	if(l==r)return x;
	if(pos<=mid)return query(ls,l,mid,pos);
	return query(rs,mid+1,r,pos);
}
void addedge(int x,int l,int r,int ll,int rr,int y){
	if(ll>rr)return;
	if(l==ll&&r==rr){
		adde(T(x),F(y));adde(T(y),F(x));
		return;
	}
	if(rr<=mid)addedge(ls,l,mid,ll,rr,y);
	else if(ll>mid)addedge(rs,mid+1,r,ll,rr,y);
	else addedge(ls,l,mid,ll,mid,y),addedge(rs,mid+1,r,mid+1,rr,y);
}
void tarjan(int x){
	dfn[x]=low[x]=++ind;
	st[++top]=x;
	Rep(p,x)
		if(!dfn[des[p]])tarjan(des[p]),low[x]=min(low[x],low[des[p]]);
		else if(!bel[des[p]])low[x]=min(low[x],dfn[des[p]]);
	if(dfn[x]==low[x]){
		sccnum++;
		while(st[top]!=x)bel[st[top]]=sccnum,top--;
		bel[st[top]]=sccnum,top--;
	}
}
bool check(int d){
	maxi=0;
	memset(head,0,sizeof head);tot=0;
	build(1,1,m);
	rep(i,1,n){
		int x1=query(1,1,m,id[i][0]),x2=query(1,1,m,id[i][1]);
		adde(T(x1),F(x2));adde(F(x1),T(x2));
		adde(T(x2),F(x1));adde(F(x2),T(x1));
	}
	rep(i,1,m){
		int num=q[i].w1,x=query(1,1,m,i);
		int L=lower_bound(q+1,q+m+1,mp(num-d+1,0))-q;
		addedge(1,1,m,L,i-1,x);
		int R=lower_bound(q+1,q+m+1,mp(num+d,0))-q-1;
		addedge(1,1,m,i+1,R,x);
	}
	rep(i,2,maxi<<1|1)dfn[i]=low[i]=bel[i]=0;top=ind=sccnum=0;
	rep(i,2,maxi<<1|1)if(!dfn[i])tarjan(i);
	rep(i,1,maxi)if(bel[T(i)]==bel[F(i)])return 0;
	return 1;
}
int main(){
	read(n);
	rep(i,1,n){
		int x,y;read(x);read(y);
		q[++m]=mp(x,i);
		q[++m]=mp(y,i);
	}
	sort(q+1,q+m+1);
	rep(i,1,m)
		if(!id[q[i].w2][0])id[q[i].w2][0]=i;
		else id[q[i].w2][1]=i;
	int l=0,r=1e9,ans=l;
	while(l<=r){
		if(check(mid))ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 28928