#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void debug(vec &v) {
	int n = v.size();
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << v[i];
	}
	cout << "\n";
}

struct graph {
private:
	int n;
	vector<vector<int>> G, rG;
	vector<bool> used;
	vector<int> vs;

	int mk;
	vector<vector<int>> fG;
	vector<vector<int>> ori;
	vector<int> trans;
public:
	graph(int sz) {
		n = sz;
		G.resize(n);
		rG.resize(n);
		used.resize(n);

		fG.resize(n);
		trans.resize(n, -1);
		ori.resize(n);
	}
	void add_edge(int a, int b) {
		G[a].push_back(b);
		rG[b].push_back(a);
	}
	void dfs(int v) {
		used[v] = true;
		rep(i, G[v].size()) {
			if (!used[G[v][i]])dfs(G[v][i]);
		}
		vs.push_back(v);
	}
	void rdfs(int v, int k) {
		used[v] = true;
		queue<int> q; q.push(v);
		vector<int> c;
		while (!q.empty()) {
			int id = q.front(); q.pop();
			ori[k].push_back(id);
			rep(j, rG[id].size()) {
				int to = rG[id][j];
				if (used[to]) {
					if (trans[to] >= 0)c.push_back(trans[to]);
					continue;
				}
				used[to] = true; q.push(to);
			}
		}
		sort(c.begin(), c.end());
		int len = unique(c.begin(), c.end()) - c.begin();
		rep(i, len) {
			fG[c[i]].push_back(k);
		}
		rep(i, ori[k].size()) {
			trans[ori[k][i]] = k;
		}
	}
	void scc() {
		fill(used.begin(), used.end(), false);
		rep(i, n) {
			if (!used[i])dfs(i);
		}
		fill(used.begin(), used.end(), false);
		int k = 0;
		per(i, (int)vs.size()) {
			if (!used[vs[i]]) {
				rdfs(vs[i], k); k++;
			}
		}
		mk = k;
	}
	bool valid(int l, int r, int ad) {
		Rep(i, l, r) {
			if (trans[i] == trans[i + ad])return false;
		}
		return true;
	}
};


vector<P> v;
vector<int> x;
vector<P> ps;
int n;

bool check(int m) {
	int sz = 1;
	while (sz < 2*n)sz *= 2;
	int ad = 2 * sz;
	graph g(2 * ad);
	per(i, sz - 1) {
		g.add_edge(i, 2 * i + 1);
		g.add_edge(i, 2 * i + 2);
		g.add_edge(i+ad, 2 * i + 1+ad);
		g.add_edge(i+ad, 2 * i + 2+ad);

	}
	rep(i, ps.size()) {
		int l = ps[i].first, r = ps[i].second;
		l += sz - 1;
		r += sz - 1;
		g.add_edge(l, r + ad);
		g.add_edge(l + ad, r);
		g.add_edge(r, l + ad);
		g.add_edge(r + ad, l);
	}
	rep(i, 2 * n) {
		int a = upper_bound(x.begin(), x.end(), x[i] - m) - x.begin();
		int b = lower_bound(x.begin(), x.end(), x[i] + m) - x.begin();
		if (a < b) {
			function<void(int,int,int,int,int)> dfs = [&](int a, int b, int k, int l, int r) {
				if (r <= a || b <= l)return;
				else if (a <= l && r <= b) {
					g.add_edge(i+sz-1, k+ad);
				}
				else {
					dfs(a, b, k * 2 + 1, l, (l + r) / 2);
					dfs(a, b, k * 2 + 2, (l + r) / 2, r);
				}
			};
			if (a < i) {
				dfs(a, i, 0, 0, sz);
			}
			if (i < b) {
				dfs(i + 1, b, 0, 0, sz);
			}
		}
	}
	g.scc();
	return g.valid(sz - 1, sz - 1 + 2 * n,ad);
}
void solve() {
	cin >> n;
	rep(i, n) {
		int a, b; cin >> a >> b;
		v.push_back({ a,b });
		x.push_back(a);
		x.push_back(b);

	}
	sort(x.begin(), x.end());
	{
		vector<P> memo;
		rep(i, v.size()) {
			memo.push_back({ v[i].first,i });
			memo.push_back({ v[i].second,i });
		}
		sort(memo.begin(), memo.end());
		ps.resize(n, { -1,-1 });
		rep(i, memo.size()) {
			int id = memo[i].second;
			if (ps[id].first < 0) {
				ps[id].first = i;
			}
			else {
				ps[id].second = i;
			}
		}
	}
	int le = -1, ri = mod;
	while (ri - le > 1) {
		int mid = (le + ri) / 2;
		if (check(mid))le = mid;
		else ri = mid;

	}
	cout << le << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(17);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
	return 0;
}


Measured memory_bytes: 33716