// Slower C++ solution:
#include <bits/stdc++.h> 

#define Rg register 

#define IL inline  

#define Debug cout << " ----- " << endl ;  

using namespace std ; 

const int N = 3e4 + 5 ;  

int n , tot , sum , col[N] , dfn[N] , low[N] , top , sta[N] , pos[N] , block ; 

vector <int> v[N] ; bool In[N] ; 

struct node { int whe , id ; } a[N] ; 

bool cmp ( node A , node B ) { return A.whe < B.whe ; } 

IL void add( Rg int x , Rg int y ) { v[x].push_back(y) ; } 

IL int op ( Rg int x ) { return x % 2 == 0 ? x-1 : x+1 ; }   

IL int Sch ( Rg int Val ) { 

    Rg int l = 1 , r = (n<<1) , mid , Ans = 0 ; 

    if( Val <= a[l].whe ) return l ;  

    if( Val >= a[r].whe ) return r ; 

    while( l <= r ) { 

    	mid = l+r >> 1 ; 

    	if( Val <= a[mid].whe ) Ans = mid , r = mid - 1 ; 

		  else l = mid+1 ;  

	} 

	return Ans ; 

} 

void tarjan( Rg int x ) { 

	In[x] = 1 ; dfn[x] = low[x] = ++ tot ; sta[++top] = x ;  

	for(Rg int i=0 ; i<v[x].size(); i++) { 

		int u = v[x][i] ; 

		if( !dfn[u] ) tarjan( u ) , low[x] = min( low[x] , low[u] ) ; 

		  else if( In[u] ) low[x] = min( low[x] , dfn[u] ) ;  

	} 

	if( dfn[x] == low[x] ) { 

	     sum ++ ; int per = sta[top] ;  

	     while( per != x ) 

	         col[per] = sum , In[per] = 0 , per = sta[--top] ; 

		 col[x] = sum , In[x] = 0 , top -- ;  

	} 

} 

void Build( int fro , int x , int y ) { 

    if( x > y ) return ; int l = pos[x] , r = pos[y] ; 

	if( l == r ) { for(Rg int i=x; i<=y; i++) add( fro , op(a[i].id) ) ; return ; } 

	for(Rg int i=x; i<=l*block; i++) add( fro , op(a[i].id) ) ; 

	for(Rg int i=l+1; i<r; i++) add( fro , i+(n<<1) ) ;  

	for(Rg int i=(r-1)*block+1 ; i<=y; i++) add( fro , op(a[i].id) )  ; 

} 

bool check( int H ) { 

    for(Rg int i=1; i<=(n<<1)+pos[n] ; i++) col[i] = dfn[i] = low[i] = 0 ; 

    for(Rg int i=1; i<=(n<<1)+pos[n] ; i++) v[i].clear( ) ; 

    for(Rg int i=1; i<=(n<<1) ; i++) v[(n<<1)+pos[i]].push_back(op(a[i].id)) ; 

    tot = sum = top = 0 ; int l , r ; 

    for(Rg int i=1; i<=(n<<1) ; i++) {  

        l = Sch( a[i].whe-H+1 ) ; r = Sch( a[i].whe+H ) ; 

        Build( a[i].id , l , i-1 ) ; Build( a[i].id , i+1 , r-1 ) ; 

	} 

	for(Rg int i=1; i<=(n<<1); i++) if( !dfn[i] ) tarjan(i) ; 

	for(Rg int i=1; i<=n; i++) if( col[a[i].id] == col[op(a[i].id)] ) return 0 ; 

	return 1 ; 

} 

signed main() { 

    ios::sync_with_stdio(false) ; 

    cin.tie(0) ; cout.tie(0) ; 

    cin >> n ; 

    for(Rg int i=1; i<=n; i++) 

      cin >> a[(i<<1)-1].whe >> a[i<<1].whe , 

       a[(i<<1)-1].id = (i<<1) - 1 , a[i<<1].id = ( i<<1 ) ; 

    sort( a+1 , a+(n<<1)+1 , cmp ) ; 

    block = sqrt( n << 1 ) ; 

    for(Rg int i=1; i<=(n<<1); i++) pos[i] = (i-1)/block+1 ; 

    int l = 1 , r = a[n<<1].whe - a[1].whe , mid , Ans = 0  ;  

    while( l <= r ) { 

    	mid = l+r >> 1 ; 

    	if( check(mid) ) Ans = mid , l = mid+1 ; 

    	  else r = mid-1 ; 

	}  

	cout << Ans << '\n' ;

	return 0 ; 

} 

// Faster C++ solution for the same problem (measured speedup: 1.0667282940608007x):
#include<bits/stdc++.h>

#define pii pair<int,int> 

#define mp make_pair

using namespace std;

const int mxn=2e4+4;

int X[mxn],n,cnt;

int ord[mxn],scc[mxn],mid;

set<pii>s;

bool used[mxn];

inline void dfs(int a,int x){

	int tx,po;

	if(a<=n)tx=X[a+n],po=a+n;

	else tx=X[a-n],po=a-n;

	used[a]=1;

	s.erase(mp(tx,po));

	for(;s.size();){

		set<pii>::iterator it=s.lower_bound(mp(x-mid+1,-1));

		if(it==s.end() or it->first>x+mid-1)break;

		int y=it->second;

		if(y==a){

			it++;

			if(it==s.end() or it->first>x+mid-1)break;

			y=it->second;

		}

		if(y>n)dfs(y-n,X[y-n]);

		else dfs(y+n,X[y+n]);

	}

	ord[++cnt]=a;

}

inline void dfs2(int a,int x){

	scc[a]=cnt;

	s.erase(mp(x,a));

	int tx;

	if(a<=n)tx=X[a+n];

	else tx=X[a-n];

	for(;s.size();){

		set<pii>::iterator it2=s.lower_bound(mp(tx-mid+1,-1));

		if(it2==s.end() or it2->first>tx+mid-1)break;

		int y=it2->second;

		if(y==a-n or y==a+n){

			it2++;

			if(it2==s.end() or it2->first>tx+mid-1)break;

			y=it2->second;

		}

		dfs2(y,X[y]);

	}

}

inline bool check(int md){

	mid=md,s.clear();

	memset(used,0,sizeof(used));

	memset(scc,0,sizeof(scc));

	for(int i=1;i<=n*2;++i)s.insert(mp(X[i],i));

	cnt=0;

	for(int i=1;i<=n*2;++i)if(!used[i])dfs(i,X[i]);

	cnt=0;

	for(int i=1;i<=n*2;++i)s.insert(mp(X[i],i));

	for(int i=n*2;i;--i){

		if(!scc[ord[i]]){

			++cnt;

			dfs2(ord[i],X[ord[i]]);

		}

	}

	for(int i=1;i<=n;++i)if(scc[i]==scc[i+n])return 0;

	return 1;

}

int main(){

	ios_base::sync_with_stdio(false);

	cin.tie(0),cout.tie(0);

	cin>>n;

	for(int i=1;i<=n;++i){

		int x,y;cin>>x>>y;

		X[i]=x,X[i+n]=y;

	}

	int lo=0,hi=1000000009,md;

	for(;lo<hi-1;){

		int md=lo+hi>>1;

		if(check(md))lo=md;

		else hi=md; 

	}

	cout<<lo<<endl;

	return 0;

}