#include "bits/stdc++.h"
using namespace std;
typedef pair <int, int> pii;
const int inf = 1e9;
const int maxn = 20005;

struct rmq {
	int t[20010 * 4];
	rmq () {
		memset(t, 0, sizeof t);
	}
	void update(int x, int val, int c, int b, int e) {
		if(b == e) {
			t[c] = val;
			return ;
		}
		int m = (b + e) >> 1;
		int l = c << 1;
		int r = l + 1;
		if(x <= m) update(x, val, l, b, m);
		else update(x, val, r, m+1, e);
		t[c] = min(t[l], t[r]); 
	}
	int query(int x, int y, int c, int b, int e) {
		if(x <= b && e <= y) {
			return t[c];
		}
		if(y < b || e < x) return inf;
		int m = (b + e) >> 1;
		int l = c << 1;
		int r = l + 1;
		return min(query(x, y, l, b, m), query(x, y, r, m + 1, e));
	}
	int query(int x, int y) {
		if(x > y) return inf;
		return query(x, y, 1, 0, maxn);
	}
	void update(int x, int val) {
		update(x, val, 1, 0, maxn);
	}
} G, T;

int n;
int id[20010];
int x[10010], y[10010];
vector <int> g[40010];
vector <int> t[40010];
vector <pii> col;
stack <int> s;
bool vis[40010];
int birth[40010];
int D;


void addEdge(int p, int q) {
	g[p].push_back(q);
	t[q].push_back(p);
}
int prev(int idx, int d) {
//	for(int i = 0; i < idx; i++) {
//		if(col[idx].first - col[i].first < d) return i; 
//	}
//	return idx + 1;
	return upper_bound(col.begin(), col.end(), pii(col[idx].first - d, inf)) - col.begin();
}
int next(int idx, int d) {
//	for(int i = n+n-1; i > idx; i--) {
//		if(col[i].first - col[idx].first < d) return i;
//	}
//	return idx - 1;
	return lower_bound(col.begin(), col.end(), pii(col[idx].first + d, -inf)) - col.begin() - 1;
}

void dfs(int x) {
	vis[x] = true;
	if(x & 1) {
		G.update(id[x >> 1], inf);
	}
	for(auto i : g[x]) {
		if(vis[i] == false) {
			dfs(i);
		}
	}
	if(x % 2 == 0) {
		int idx = id[x >> 1];
		int bef = prev(idx, D);
		int aft = next(idx, D);
		if(bef < idx) {
			while(true) {
				int node = G.query(bef, idx - 1);
				if(node == inf) break;
				node <<= 1;
				node |= 1;
				dfs(node);
			}
		}
		if(idx < aft) {
			while(true) {
				int node = G.query(idx + 1, aft);
				if(node == inf) break;
				node <<= 1;
				node |= 1;
				dfs(node);
			}
		}
	}
	s.push(x);
}

void transpose(int x, int mark) {
	birth[x] = mark;
	vis[x] = true;
	if(x % 2 == 0) {
		T.update(id[x >> 1], inf);
	}
	for(auto i : t[x]) {
		if(vis[i] == false) {
			transpose(i, mark);
		}
	}
	if(x & 1) {
		int idx = id[x >> 1];
		int bef = prev(idx, D);
		int aft = next(idx, D);
		if(bef < idx) {
			while(true) {
				int node = T.query(bef, idx - 1);
				if(node == inf) break;
				node <<= 1;
				transpose(node, mark);
			}
		}
		if(idx < aft) {
			while(true) {
				int node = T.query(idx + 1, aft);
				if(node == inf) break;
				node <<= 1;
				transpose(node, mark);
			}
		}
	}
}

bool good(int d) {
	D = d;
	for(int i = 0; i < n+n; i++) {
		G.update(i, col[i].second);
		T.update(i, col[i].second);
	}
	/*
	for(int i = 0; i < n+n; i++) {
		for(int j = 0; j < i; j++) {
			if(col[i].first - col[j].first < d) {
				int p = col[i].second;
				int q = col[j].second;
				addEdge(p << 1, (q << 1) | 1);
				addEdge(q << 1, (p << 1) | 1);
			}
		}
	}
	*/
	memset(vis, false, sizeof vis);
	for(int i = 0; i < (n << 2); i++) {
		if(vis[i] == false) {
			dfs(i);
		}
	}
	memset(vis, false, sizeof vis);
	int cur = 0;
	while(!s.empty()) {
		int p = s.top();
		s.pop();
		if(vis[p] == false) transpose(p, ++cur);
	}
	for(int i = 0; i < n; i++) {
		int p = i << 1;
		int q = p | 1;
		if(birth[p << 1] == birth[(p << 1) | 1]) return false;
		if(birth[q << 1] == birth[(q << 1) | 1]) return false;
	}
	return true;
} 

int search(int b, int e) {
	if(b == e) {
		return b;
	}
	int m = (b + e + 1) >> 1;
	if(good(m)) return search(m, e);
	else return search(b, m-1);
}

int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		scanf("%d %d", &x[i], &y[i]);
		col.push_back(pii(x[i], i << 1));
		col.push_back(pii(y[i], (i << 1) | 1));
	}
	for(int i = 0; i < n; i++) {
		int p = i << 1;
		int q = p | 1;
		addEdge((p << 1) | 1, q << 1);
		addEdge((q << 1) | 1, p << 1);
	}
	sort(col.begin(), col.end());
	for(int i = 0; i < n+n; i++) {
		id[col[i].second] = i;
	}
	printf("%d\n", search(0, 1000000000));
	return 0;
}

Measured memory_bytes: 7804