#include <bits/stdc++.h>
using namespace std;
#define M 500010
#define fi first
#define sc second
#define pb push_back
#define LL long long
#define MP make_pair
#define MOD 998244353
#define pii pair<int, int>
#define For(i, x, y) for(int i = (x); i < (y); i ++)
#define rep(i, x, y) for(int i = (x); i <= (y); i ++)
#define drep(i, x, y) for(int i = (x); i >= (y); i --)
inline int read(){char ch=getchar();int x=0,f=1;while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while('0'<=ch&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
inline LL llread(){char ch=getchar();LL x=0,f=1;while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while('0'<=ch&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
inline int Power(int x,int y,int mod){int r=1;while(y){if(y&1)r=1ll*r*x%mod;x=1ll*x*x%mod;y>>=1;}return r;}
namespace Tarjan{
	int pre[M],low[M],sccno[M],dfs_clock,scc_cnt;
	stack<int> S;
	struct Edge{
		int u,v,Next;
	} G[M*4];int head[M],tot;
	inline void init(int n){
		rep(i,1,n)pre[i]=low[i]=sccno[i]=0;tot=0;
		memset(head,-1,sizeof(head));
		//memset(pre,0,sizeof(pre));
		dfs_clock=scc_cnt=0;while(!S.empty())S.pop();
	}
	inline void add(int u,int v){
		G[++tot]=(Edge){u,v,head[u]};
		head[u]=tot; //printf("%d %d\n",u,v);
	}
	inline void dfs(int u){
		pre[u]=low[u]=++dfs_clock;
		S.push(u);
		for(int i=head[u];i!=-1;i=G[i].Next){
			int v=G[i].v;
			if(!pre[v]){
				dfs(v);
				low[u]=min(low[u],low[v]);
			} else if(!sccno[v]){
				low[u]=min(low[u],pre[v]);
			}
		}if(low[u]==pre[u]){
			scc_cnt++;
			for(;;){
				int x=S.top();S.pop();
				sccno[x]=scc_cnt;
				if(x==u)break;
			}
		}
	}
	inline void solve(int n){
		rep(i,1,n)if(!pre[i])dfs(i);
	}
}
int a[M],b[M],rk[M];
int fri[M],cnt;
inline bool cmp(int x,int y) {
	return a[x]<a[y];
}
struct smt{
	int q[M*2];
	inline void build(int l,int r,int o,int cur){
		if(l==r){
			if(cur)q[o]=l;
			else q[o]=fri[l];
			return;
		} int mid=(l+r)/2;
		build(l,mid,2*o,cur);
		build(mid+1,r,2*o+1,cur);q[o]=++cnt;
		if(cur){
			Tarjan::add(q[2*o],q[o]);
			Tarjan::add(q[2*o+1],q[o]);
		}else{
			Tarjan::add(q[o],q[2*o]);
			Tarjan::add(q[o],q[2*o+1]);
		}
	}
	inline void change(int l,int r,int o,int x,int y,int z,int cur){
		if(x<=l&&r<=y){
			if(cur)Tarjan::add(q[o],z);
			else Tarjan::add(z,q[o]);return;
		}int mid=(l+r)/2;
		if(x<=mid)change(l,mid,2*o,x,y,z,cur);
		if(y>mid)change(mid+1,r,2*o+1,x,y,z,cur);
	}
	inline void init(int n,int cur){
		build(1,n,1,cur);
	}
} T,T_fri;
inline bool check(int n,int x){
	Tarjan::init(cnt);cnt=n+n;
	T.init(n+n,1);T_fri.init(n+n,0);
	int l=1,r=1;
	rep(i,1,n+n){
		while(a[b[l]]<=a[b[i]]-x&&l<i)l++;
		while(r<n+n&&a[b[r+1]]<a[b[i]]+x)r++;
		if(i-l>0){
			T.change(1,n+n,1,l,i-1,fri[i],1);
			T_fri.change(1,n+n,1,l,i-1,i,0);
		}if(r-i>0){
			T.change(1,n+n,1,i+1,r,fri[i],1);
			T_fri.change(1,n+n,1,i+1,r,i,0);
		}
	} Tarjan::solve(cnt);
	rep(i,1,n+n)if(Tarjan::sccno[i]==Tarjan::sccno[fri[i]]){
		return false;
	} return true;
}
int main() {
	int n=read();
	rep(i,1,n){
		a[i]=read();a[i+n]=read();
	}rep(i,1,n+n)b[i]=i;
	sort(b+1,b+n+n+1,cmp);
	rep(i,1,n+n)rk[b[i]]=i;
	rep(i,1,n){
		fri[rk[i]]=rk[i+n];
		fri[rk[i+n]]=rk[i];
	}//rep(i,1,n+n)printf("fri %d\n",fri[i]);
	int l=0,r=(int)(1e9),t;
	//check(n,17);
	while(l<=r){
		int mid=(l+r)/2;
		if(check(n,mid))l=(t=mid)+1;
		else r=mid-1;
	}cout<<t;
	return 0;
}


Measured memory_bytes: 40832