#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

ll pow1(ll a, ll b, ll m = mod)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2, m);
		x *= x;
		x %= m;
		if (b%2)
		{
			x *= a;
			x %= m;
		}
		return x;
	}
}

template <class avgType>
avgType avg(avgType a, avgType b) {
	return (a + b)/2;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());

int randInt() {
	return rng() % INT_MAX;
}

ll randLL() {
	return rng64() % LLONG_MAX;
}

vector< int > hashmods = {1000000007, 1000000009, 1000000021, 1000000033, 1000000087, 1000000093};

int n, comp[21000], vis[21000], vind[21000], l[11000], r[11000], onstack[21000], minout[21000], cnum = 1, cnt = 1, cntind[21000];
stack< int > s;
vector< pi > v;

void forward(int index, int d) {
	vis[index] = 1;
	int x = v[vind[index]].first;
	for (int i = vind[index]-1; i >= 0; i--) {
		if (x-v[i].first >= d)
			break;
		int neigh = v[i].second + (v[i].second > n ? -n : n);
		if (!vis[neigh]) {
			//cout<<index<<" "<<neigh<<" "<<v[i].second<<endl;
			forward(neigh, d);
		}
	}	

	for (int i = vind[index]+1; i < v.size(); i++) {
		if (v[i].first-x >= d)
			break;
		int neigh = v[i].second + (v[i].second > n ? -n : n);
		if (!vis[neigh]) {
			//cout<<index<<" "<<neigh<<" "<<v[i].second<<endl;
			forward(neigh, d);
		}
	}	

	s.push(index);
}

void backward(int index, int d, int c) {
	comp[index] = c;
	index += (index > n ? -n : n);
	int x = v[vind[index]].first;
	for (int i = vind[index]-1; i >= 0; i--) {
		if (x-v[i].first >= d)
			break;
		int neigh = v[i].second;
		if (comp[neigh] == 0)
			backward(neigh, d, c);
	}

	for (int i = vind[index]+1; i < v.size(); i++) {
		if (v[i].first-x >= d)
			break;
		int neigh = v[i].second;
		if (comp[neigh] == 0)
			backward(neigh, d, c);
	}
}

void tarjan(int index, int d) {
	minout[index] = cnt;
	cntind[index] = cnt++;
	vis[index] = 1;
	s.push(index);
	onstack[index] = 1;
	int x = v[vind[index]].first;

	for (int i = vind[index]-1; i >= 0; i--) {
		if (x-v[i].first >= d)
			break;
		int neigh = v[i].second + (v[i].second > n ? -n : n);
		if (!vis[neigh]) {
			//cout<<index<<" "<<neigh<<" "<<v[i].second<<endl;
			tarjan(neigh, d);
			minout[index] = min(minout[index], minout[neigh]);
		} else if (onstack[neigh]) {
			minout[index] = min(minout[index], cntind[neigh]);
		}
	}	

	for (int i = vind[index]+1; i < v.size(); i++) {
		if (v[i].first-x >= d)
			break;
		int neigh = v[i].second + (v[i].second > n ? -n : n);
		if (!vis[neigh]) {
			//cout<<index<<" "<<neigh<<" "<<v[i].second<<endl;
			tarjan(neigh, d);
			minout[index] = min(minout[index], minout[neigh]);
		} else if (onstack[neigh]) {
			minout[index] = min(minout[index], cntind[neigh]);
		}
	}	

	if (minout[index] == cntind[index]) {
		while (!s.empty()) {
			int curr = s.top(); s.pop();
			onstack[curr] = 0;
			comp[curr] = cnum;
			if (curr == index) break;
		}
		cnum++;
	}
}

bool solve(int d) {
	cnum = 1;
	cnt = 1;

	for (int i = 1; i <= 2*n; i++) {
		if (!vis[i]) {
			tarjan(i, d);
			while (!s.empty()) {
				int curr = s.top(); s.pop();
				comp[curr] = cnum;
				onstack[curr] = 0;
			}
			cnum++;
		}
	}

	bool ok = true;
	for (int i = 1; i <= n; i++) {
		//cout<<i<<" "<<(i+n)<<" "<<comp[i]<<" "<<comp[i+n]<<endl;
		if (comp[i] == comp[i+n])
			ok = false;
		vis[i] = 0;
		vis[i+n] = 0;
		//comp[i] = 0;
		//comp[i+n] = 0;
		//minout[i] = minout[i+n] = 0;
	}

	return ok;
}

int main() {
	fastio;
	cin>>n;
	for (int i = 1; i <= n; i++) {
		cin>>l[i]>>r[i];
		v.pb(mp(l[i], i));
		v.pb(mp(r[i], i+n));
	}

	sort(v.begin(), v.end());

	int opt = 1e9;
	for (int i = 1; i <= n; i++) {
		int m1 = 1e9, m2 = 1e9;
		for (int j = 1; j <= n; j++) {
			if (i == j)
				continue;
			m1 = min({m1, max(abs(l[i]-l[j]), abs(l[i]-r[j]))});
			m2 = min({m2, max(abs(r[i]-l[j]), abs(r[i]-r[j]))});
		}

		opt = min(opt, max(m1, m2));
	}

	for (int i = 0; i < v.size(); i++) {
		vind[v[i].second] = i;
	}

	int beg = 1, end = opt, ans = 0;
	while (beg <= end) {
		int mid = avg(beg, end);
		bool ok = solve(mid);
		//cout<<mid<<" "<<ok<<endl;
		if (ok) {
			ans = mid;
			beg = mid+1;
		} else {
			end = mid-1;
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 2428