#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

using cat = long long;

void DFS_SCC(int R, auto & G, auto & comp, auto & st, auto & in_st, auto & idx, auto & min_idx, int & nxt_idx) {
	in_st[R] = true;
	st.push_back(R);
	idx[R] = min_idx[R] = nxt_idx++;
	ALL_THE(G[R], it) {
		if(idx[*it] == -1) {
			DFS_SCC(*it, G, comp, st, in_st, idx, min_idx, nxt_idx);
			min_idx[R] = min(min_idx[R], min_idx[*it]);
		}
		else if(in_st[*it])
			min_idx[R] = min(min_idx[R], min_idx[*it]);
	}
	if(idx[R] == min_idx[R]) {
		vector<int> nxt_comp;
		while(true) {
			int x = st.back();
			st.pop_back();
			in_st[x] = false;
			nxt_comp.push_back(x);
			if(x == R) break;
		}
		comp.push_back(nxt_comp);
	}
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector< vector<int> > X(N, vector<int>(2));
	vector< pair<int, int> > pos(2*N);
	for(int i = 0; i < N; i++) {
		cin >> X[i][0] >> X[i][1];
		pos[2*i] = {X[i][0], i};
		pos[2*i+1] = {X[i][1], i};
	}
	sort(begin(pos), end(pos));
	vector< vector<int> > Xpos(N, vector<int>(2, OVER9000));
	for(int i = 0; i < 2*N; i++) {
		if(Xpos[pos[i].ss][0] == OVER9000) Xpos[pos[i].ss][0] = i;
		else Xpos[pos[i].ss][1] = i;
	}
	int dist_l = 0, dist_r = pos[2*N-1].ff-pos[0].ff+1;
	while(dist_r-dist_l > 1) {
		int dist_m = (dist_l+dist_r)/2;
		vector<int> L(2*N), R(2*N);
		int r = 0, l = 0;
		for(int i = 0; i < 2*N; i++) {
			while(r < 2*N && pos[r].ff < pos[i].ff+dist_m) r++;
			while(pos[l].ff <= pos[i].ff-dist_m) l++;
			L[i] = l, R[i] = r;
		}
		int K = 17;
		vector<int> cnt_v(K, 0), sumcnt_v(K+1, 0);
		int V = 0;
		for(int i = 0; i < K; i++) {
			cnt_v[i] = (2*N+(1<<i)-1)/(1<<i);
			V += cnt_v[i];
			sumcnt_v[i+1] = sumcnt_v[i] + cnt_v[i];
		}
		vector< vector<int> > G(2*V);
		for(int i = 1; i < K; i++) for(int x = 0; x < 2*N; x += (1<<i)) {
			int j = x/(1<<i);
			// if (i, j) false: (i-1, s1), (i-1, s2) false
			// if (i-1, s1) or (i-1, s2) has true: (i, j) has true
			G[2*(sumcnt_v[i]+j)].push_back(2*(sumcnt_v[i-1]+2*j));
			G[2*(sumcnt_v[i-1]+2*j)+1].push_back(2*(sumcnt_v[i]+j)+1);
			if(2*j+1 < cnt_v[i-1]) {
				G[2*(sumcnt_v[i]+j)].push_back(2*(sumcnt_v[i-1]+2*j+1));
				G[2*(sumcnt_v[i-1]+2*j+1)+1].push_back(2*(sumcnt_v[i]+j)+1);
			}
		}
		for(int i = 0; i < 2*N; i++) {
			// if (0, i) is true: (0, [L[i], i)) is false
			// if (0, [L[i], i)) has true: (0, i) false
			l = L[i], r = i;
			for(int k = 0; k < K; k++) {
				if(l == r) break;
				if((l>>k)&1 && l+(1<<k) <= r) {
					G[2*i+1].push_back(2*(sumcnt_v[k]+l/(1<<k)));
					G[2*(sumcnt_v[k]+l/(1<<k))+1].push_back(2*i);
					l += 1<<k;
				}
				if((r>>k)&1 && l+(1<<k) <= r) {
					r -= 1<<k;
					G[2*i+1].push_back(2*(sumcnt_v[k]+r/(1<<k)));
					G[2*(sumcnt_v[k]+r/(1<<k))+1].push_back(2*i);
				}
			}
			// if (0, i) is true: (0, [i+1, R[i])) is false
			l = i+1, r = R[i];
			for(int k = 0; k < K; k++) {
				if(l == r) break;
				if((l>>k)&1 && l+(1<<k) <= r) {
					G[2*i+1].push_back(2*(sumcnt_v[k]+l/(1<<k)));
					G[2*(sumcnt_v[k]+l/(1<<k))+1].push_back(2*i);
					l += 1<<k;
				}
				if((r>>k)&1 && l+(1<<k) <= r) {
					r -= 1<<k;
					G[2*i+1].push_back(2*(sumcnt_v[k]+r/(1<<k)));
					G[2*(sumcnt_v[k]+r/(1<<k))+1].push_back(2*i);
				}
			}
		}
		for(int i = 0; i < 2*N; i++) {
			int j = Xpos[pos[i].ss][0]+Xpos[pos[i].ss][1]-i;
			// (0, i) xor (0, j) is true
			G[2*i].push_back(2*j+1);
			G[2*i+1].push_back(2*j);
		}
		// SAT
		vector<int> st, min_idx(2*V), idx(2*V, -1);
		vector<bool> in_st(2*V, false);
		vector< vector<int> > comp;
		int nxt_idx = 0;
		for(int i = 0; i < 2*V; i++) if(idx[i] == -1)
			DFS_SCC(i, G, comp, st, in_st, idx, min_idx, nxt_idx);
		vector<int> in_comp(2*V);
		for(int i = 0; i < (int)comp.size(); i++)
			ALL_THE(comp[i], it) in_comp[*it] = i;
		bool ok = true;
		for(int i = 0; i < V; i++)
			if(in_comp[2*i] == in_comp[2*i+1]) ok = false;
		if(ok) dist_l = dist_m;
		else dist_r = dist_m;
	}
	cout << dist_l << "\n";
}

// look at my code
// my code is amazing


Measured memory_bytes: 26256