#include <bits/stdc++.h>
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<int, int> pii;
const int maxn = 2e4 + 10;
const int maxm = maxn << 2; //线段树*4
int n, tot, no, top, e, cnt;
int a[maxn], b[maxn], C[maxn], match[maxn], pos[maxn][2];
pii c[maxn];
int id[maxm][2];
vector<int> ed[maxm << 1]; //2-sat*2
int dfn[maxm << 1], low[maxm << 1], sta[maxm << 1], belong[maxm << 1];
void build(int rt, int l, int r)
{
	id[rt][0] = ++no; id[rt][1] = ++no;
	ed[id[rt][0]].clear(); ed[id[rt][1]].clear();
	if(l == r) 
	{
		match[l] = rt;
		return;
	}
	int mid = l + r >> 1;
	build(ls, l, mid); ed[id[rt][0]].push_back(id[ls][0]); ed[id[ls][1]].push_back(id[rt][1]);
	build(rs, mid + 1, r); ed[id[rt][0]].push_back(id[rs][0]); ed[id[rs][1]].push_back(id[rt][1]);
}
inline void cmin(int& u, int& v)
{
	u = u > v ? v : u;
}
void tarjan(int u)
{
	dfn[u] = low[u] = ++e;
	sta[++top] = u;
	for(int i = 0; i < ed[u].size(); ++i)
	{
		int v = ed[u][i];
		if(!dfn[v])
			tarjan(v), cmin(low[u], low[v]);
		else if(!belong[v])
			cmin(low[u], dfn[v]);
	}
	if(low[u] == dfn[u])
		for(++cnt; sta[top + 1] ^ u; --top)
			belong[sta[top]] = cnt;
}
bool solve()
{
	for(int i = 1; i <= (no << 1); ++i)
		if(!dfn[i])
			tarjan(i);
	for(int i = 1; i <= no; ++i)
		if(belong[(i << 1) - 1] == belong[i << 1])
			return 0;
	return 1;
}
void update(int rt, int l, int r, int a, int b, int x)
{
	if(a > b) return;
	if(a <= l && r <= b)
	{
		ed[id[x][1]].push_back(id[rt][0]);
		ed[id[rt][1]].push_back(id[x][0]);
		return;
	}
	int mid = l + r >> 1;
	if(a <= mid) update(ls, l, mid, a, b, x);
	if(b > mid) update(rs, mid + 1, r, a, b, x);
}
bool check(int d)
{
	top = e = cnt = no = 0;
	memset(dfn, 0, sizeof dfn);
	memset(low, 0, sizeof low);
	memset(belong, 0, sizeof belong);
	memset(sta, 0, sizeof sta);
	build(1, 1, tot);
	for(int i = 1; i <= n; ++i)
	{
		int l = match[pos[i][0]], r = match[pos[i][1]];
		ed[id[l][0]].push_back(id[r][1]);
		ed[id[l][1]].push_back(id[r][0]);
		ed[id[r][0]].push_back(id[l][1]);
		ed[id[r][1]].push_back(id[l][0]);
	}
	for(int i = 1; i <= tot; ++i)
	{
		int l = lower_bound(C + 1, C + tot + 1, C[i] - d + 1) - C;
		int r = upper_bound(C + 1, C + tot + 1, C[i] + d - 1) - C - 1;
		update(1, 1, tot, l, i - 1, match[i]);
		update(1, 1, tot, i + 1, r, match[i]);
	}
	return solve(); 
}		
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)	
	{
		scanf("%d%d", &a[i], &b[i]);
		if(a[i] > b[i]) swap(a[i], b[i]);
		++tot; c[tot] = mp(a[i], tot);
		++tot; c[tot] = mp(b[i], tot);
	}
	sort(c + 1, c + tot + 1);
	for(int i = 1; i <= tot; ++i)
	{
		pos[(c[i].second + 1) >> 1][(c[i].second + 1) & 1] = i;
		C[i] = c[i].first;
	}
	int l = 0, r = C[tot] - C[1];
	while(l <= r)
	{
		int mid = l + r >> 1;
		if(check(mid))
			l = mid + 1;
		else
			r = mid - 1;
	}	
	printf("%d\n", r);
	return 0;
}
	
		