# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n;
vector < pair < int, int > > vv;
pair < int, int > a[N], p[N];
vector < int > g[N], gr[N];
int pos[N], col[N], u[N];

void add (int a, int b) {
	g[a].pb(b);
	gr[b].pb(a);
}

void build (int v, int tl, int tr) {
	g[v].clear();
	gr[v].clear();
	col[v] = 0;
	u[v] = 0;

	if (tl == tr) {
		pos[tl] = v;
		return ;
	}
	int tm = (tl + tr) >> 1, c1 = (v << 1), c2 = (c1 | 1);
	build (c1, tl, tm);
	build (c2, tm + 1, tr);
	add(v, c1);
	add(v, c2);
}

void upd (int l, int r, int x, int v, int tl, int tr) {
	if (tl > r || l > r || tr < l) return;
	if (tl >= l && tr <= r) {
		add(x, v);
		return;
	}

	int tm = (tl + tr) >> 1;
	upd(l, r, x, v << 1, tl, tm);
	upd(l, r, x, v << 1 | 1, tm + 1, tr);
}
vector < int > tp;
void dfs (int v) {
	u[v] = 1;
	for (auto to : g[v]) if (!u[to]) {
		dfs(to);
	}
	tp.pb(v);
}

void rdfs (int v, int cur) {
	col[v] = cur;
	for (auto to : gr[v]) if (!col[to]) {
		rdfs(to, cur);
	}
	
}


bool check (int d) {
	build(1, 0, n * 4 - 1);

	for (int i = 0; i < n; i ++) {
		int a = p[i].F;
		int b = p[i].S;

		add(pos[a], pos[b + 2 * n]);
		add(pos[b + 2 * n], pos[a]);
		add(pos[b], pos[a + 2 * n]);
		add(pos[a + 2 * n], pos[b]);
	}

	for (int i = 0; i < 2 * n; i ++) {
		int l = upper_bound(vv.begin(), vv.end(), mp(vv[i].F - d, n * 9)) - vv.begin();
        int r = lower_bound(vv.begin(), vv.end(), mp(vv[i].F + d, 0)) - vv.begin() - 1;

        upd(n * 2 + l, n * 2 + i - 1, pos[i], 1, 0, n * 4 - 1);
        upd(n * 2 + i + 1, n * 2 + r, pos[i], 1, 0, n * 4 - 1);
	}
	tp.clear();
	for (int i = 0; i < 16 * n; i ++) if (!u[i]) {
		dfs(i);
	}
	reverse(every(tp));

	int ptr = 0;
	for (auto v : tp) if (!col[v]) {
		
		rdfs(v, ++ptr);
	}

	for (int i = 0; i < 2 * n; i ++) {
		if (col[pos[i]] == col[pos[i + 2 * n]]) 
			return 0;
	}
	return 1;
}

int main () {
	SpeedForce;
	cin >> n;
	           
	for (int i = 0; i < n; i ++) {
		cin >> a[i].F >> a[i].S;
		vv.pb(mp(a[i].F, i));
		vv.pb(mp(a[i].S, i));
		p[i] = mp(-1, -1);
	}


	sort(every(vv));

	for (int j = 0; j < 2 * n; j ++) {
		int i = vv[j].S;
		if (p[i].F == -1) p[i].F = j;
		else p[i].S = j;
	} 

	int l = 0, r = 1e9 + 1;
	while (r - l > 1) {
		int md = (l + r) >> 1;
		if (check(md))
			l = md;
		else
			r = md;
	}

	cout << l << '\n';
	
   	return Accepted;
}

// B...a

Measured memory_bytes: 57716