#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> vi;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const ll INF=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
ll quick(ll a,ll b)
{
	ll ret=1;
	while(b)
	{
		if(b&1) ret=ret*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ret;
}
const int maxn=1e4+7;
int n;
int x[maxn][2];
struct Point{
	int id,tp,val;
	bool operator<(const Point&a)const{
		return val<a.val;
	}
};
vector<Point> pt;
int id[maxn*2];
vi G[maxn<<3];
inline void addedge(int u,int v)
{
	G[u].push_back(v);
}
#define lson o<<1
#define rson o<<1|1
#define Lson L,mid,lson
#define Rson mid+1,R,rson
void build(int L=0,int R=n*2-1,int o=1)
{
	if(L==R)
	{
		id[pt[L].id^1]=o;
		return;
	}
	int mid=L+R>>1;
	addedge(o,lson);
	addedge(o,rson);
	build(Lson);
	build(Rson);
}
void update(int l,int r,int p,int L=0,int R=n*2-1,int o=1)
{
	if(l<=L&&r>=R)
	{
		addedge(p,o);
		return;
	}
	int mid=L+R>>1;
	if(l<=mid) update(l,r,p,Lson);
	if(r>mid) update(l,r,p,Rson);
}
int dfn[maxn<<3], low[maxn<<3], bel[maxn<<3];
int ti, scc; //时间戳与联通分量计数
stack<int> st;
void dfs(int u, int fa)
{
    dfn[u] = low[u] = ++ti;
    st.push(u);
    for (auto v:G[u])
    {
        if (v == fa)
            continue;
        if (!dfn[v])
        {
            dfs(v, u);
            low[u] = min(low[u], low[v]);
        }
        else if (!bel[v])
            low[u] = min(low[u], dfn[v]);
    }
    if (dfn[u] == low[u])
    {
        scc++;
        while (1)
        {
            int t = st.top();
            st.pop();
            bel[t] = scc;
            if (u == t)
                break;
        }
    }
}
void SCC()
{
	memset(dfn,0,sizeof(dfn));
	memset(bel,0,sizeof(bel));
	ti=scc=0;
    for (int i = 1; i <= n; i++)
        if (!dfn[i])
            dfs(i, -1);
}
bool check(int x)
{
	if(!x) return true;
	for(int i=0;i<(n<<3);i++)
		G[i].clear();
	build();
	for(int i=0;i<n*2;i++)
	{
		int p=id[pt[i].id];
		int L=pt[i].val-x+1,R=pt[i].val+x-1;
		int lp=lower_bound(pt.begin(),pt.end(),Point{0,0,L})-pt.begin();
		int rp=upper_bound(pt.begin(),pt.end(),Point{0,0,R})-pt.begin()-1;
		if(lp<i)
			update(lp,i-1,p);
		if(rp>i)
			update(i+1,rp,p);
	}
	SCC();
	for(int i=0;i<n*2;i+=2)
		if(bel[id[i]]==bel[id[i^1]]) return false;
	return true;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x[i][0]>>x[i][1];
		pt.push_back({2*i,0,x[i][0]});
		pt.push_back({2*i+1,1,x[i][1]});
	}
	sort(pt.begin(),pt.end());
	//for(int i=0;i<2*n;i++)
	//	dbg(i,pt[i].id,pt[i].val);
	int L=0,R=1e9,ans=-1;
	while(L<=R)
	{
		int mid=L+R>>1;
		if(check(mid))
		{
			ans=mid;
			L=mid+1;
		}
		else R=mid-1;
	}
	cout<<ans<<'\n';
}

Measured memory_bytes: 11516