#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 2e5+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}

// vector <int> P;
vector <int> e[2*N],re[2*N];
int vis[2*N],comp[2*N];

void addEdge(int v, int u) {
   // printf("%d %d\n",v,u);
    e[v].pb(u);
    e[u ^ 1].pb(v ^ 1);
    re[u].pb(v);
    re[v ^ 1].pb(u ^ 1);
}

vector <int>  ord;

void dfs_ord(int v) {
    if (vis[v]) return;
    vis[v] = 1;
    // printf("%d\n",v);
    for (int u=0;u<e[v].size();u++) dfs_ord(e[v][u]);
    ord.pb(v);
}

void dfs_mark(int v, int c) {
    if (vis[v]) return;
    vis[v] = 1;
    comp[v] = c;
    for (int u=0;u< re[v].size();u++) dfs_mark(re[v][u], c);
}

int val(int v) {
    return comp[v] > comp[v + 1];
}

vector <pii> A;
pii P[N];
int B[20010][20],LG[N],cnt,C[N];

void maketree(int a,int b,int nod){
	if(a==b){
		C[a]=nod;return;
	}
	int m = (a+b)/2;
	maketree(a,m,2*nod);
	maketree(m+1,b,2*nod+1);
	addEdge(2*nod+1,2*(2*nod)+1);
	addEdge(2*nod+1,2*(2*nod+1)+1);	
}

void gg(int a,int b,int nod,int l,int r,int p){
	if(b<l || a>r) return;
	if(l<=a && b<=r){
		addEdge(2*C[p],2*nod+1);
		return;
	}
	int m = (a+b)/2;
	gg(a,m,2*nod,l,r,p);
	gg(m+1,b,2*nod+1,l,r,p);
}

int pos(int d,int n){
	// printf("%d\n",cnt);
	cnt = 8*n;
	REP(i,2*cnt) e[i].clear(),re[i].clear(),vis[i]=0,comp[i]=0;
	int in1 = 0,in2 = 0;
	maketree(0,A.size()-1,1);
	REP(i,n){
		int a = lower_bound(all(A),mp(P[i].X,i))-A.begin();
		int b = lower_bound(all(A),mp(P[i].Y,i))-A.begin();
		if(a==b) b++;
		addEdge(2*C[a],2*C[b]+1);
		addEdge(2*C[a]+1,2*C[b]);
		// printf("%d %d\n",a,b);
	}
	REP(i,A.size()){
		while(in2<A.size() && A[in2].X-A[i].X<d) in2++;
		while(A[i].X-A[in1].X>=d) in1++;
		int p = in2-1 - i;
		// printf("%d %d %d\n",in1,in2,i);
		if(i+1<A.size() && in2-i>1){
			gg(0,A.size()-1,1,i+1,in2-1,i);
			// addEdge(2*i,2*B[i+1][LG[p]]+1);
			// addEdge(2*i,2*B[in2-(1<<LG[p])][LG[p]]+1);
		}
		// printf("gg\n");
		if(in1<i){
			p = i-in1;
			gg(0,A.size()-1,1,in1,i-1,i);
			// addEdge(2*i,2*B[in1][LG[p]]+1);
			// addEdge(2*i,2*B[i-(1<<LG[p])][LG[p]]+1);
		}
		// printf("rr\n");
	}
	// REP(i,A.size()) REPP(j,1,LG[(int)A.size()]+1) addEdge(2*B[i][j]+1,2*B[i][j-1]+1),
	// 						addEdge(2*B[i][j]+1,2*B[i+(1<<(j-1))][j-1]+1);
	REP(i, 2*cnt){ dfs_ord(i);}
	// printf("hi\n");
    reverse(all(ord));
    REP(i, 2*cnt) vis[i] = 0;
    int cc = 0;
    for (int v=0;v< ord.size();v++) {
      //  printf("%d ",ord[v]);
        if (vis[ord[v]]) continue;
        dfs_mark(ord[v], cc++);
    }
    //printf("\n");
    bool ok = true;
    REP(i, cnt) ok &= comp[2 * i] != comp[2 * i + 1];
    if (!ok) {
        return 0;
    }
    // cout << "YES\n";
    return 1;
}

int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	int n; scanf("%d",&n);
	// int n = 10000;
	// srand(time(NULL));
	REP(i,n){
		// P[i].X = rand()%mod;
		// P[i].Y = rand()%mod;
	scanf("%d%d",&P[i].X,&P[i].Y);
	// assert(P[i].X!=P[i].Y);
	} 
	REP(i,n) A.pb(mp(P[i].X,i)),A.pb(mp(P[i].Y,i));
	// cnt = 0;
	// LG[1] = 0;
	// int p = 2;
	// REPP(i,2,A.size()+100){
	// 	if(i==p) LG[i]=1,p*=2;
	// 	LG[i]+=LG[i-1];
	// }
	// // printf("%d %d\n",LG[(int)A.size()],(int)A.size());
	// REP(j,LG[(int)A.size()]+2) REP(i,A.size()){
	// 	// printf("%d\n",cnt);
	// 	B[i][j]=cnt++;
	// }
	// printf("%d\n",cnt);
	sort(all(A));
	int l = 1, r = mod; 
	int ans = 0;

	while(l<=r){
		int mid = (l+r)/2;
		// printf("%d\n",mid);
		if(pos(mid,n)) ans = mid,l = mid+1;
		else r = mid-1;
	}
	assert(ans<=1e9);
	printf("%d\n",ans);
	return 0;
}




Measured memory_bytes: 89316