#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

template <class T>
inline void tense(T &a, const T &b)
{
	if (b < a)
		a = b;
}

const int MaxN = 10000;
const int MaxM = MaxN * 2;
const int MaxLogM = 16;
const int MaxNV = MaxM * 4;
const int MaxNE = MaxNV * 2 + MaxM * MaxLogM * 4;

const int INF = 0x3f3f3f3f;

int n, m;
int vl[MaxN + 1], vr[MaxN + 1];

struct halfEdge
{
	int v;
	halfEdge *next;
};
halfEdge adj_pool[MaxNE], *adj_tail = adj_pool;
halfEdge *adj[MaxNV + 1];

inline void addEdge(const int &u, const int &v)
{
	adj_tail->v = v, adj_tail->next = adj[u];
	adj[u] = adj_tail++;
}

int dfs_clock = 0;
int dfn[MaxNV + 1], low[MaxNV + 1];

int sta_n = 0, sta[MaxNV + 1];

int scc_n = 0;
int sccNum[MaxNV + 1];

void dfs(const int &u)
{
	dfn[u] = low[u] = ++dfs_clock;
	sta[++sta_n] = u;

	for (halfEdge *e = adj[u]; e; e = e->next)
	{
		if (!dfn[e->v])
		{
			dfs(e->v);
			tense(low[u], low[e->v]);
		}
		else if (!sccNum[e->v])
			tense(low[u], dfn[e->v]);
	}

	if (dfn[u] == low[u])
	{
		++scc_n;

		int v = -1;
		while (v != u)
			sccNum[v = sta[sta_n--]] = scc_n;
	}
}

int seg_n = 1;
int lc[MaxNV + 1], rc[MaxNV + 1];

int ver[MaxM + 1];

void seg_build(int p, int pL, int pR)
{
	if (pL == pR)
		ver[pL] = p;
	else
	{
		int pM = pL + pR >> 1;
		lc[p] = ++seg_n;
		rc[p] = ++seg_n;
		seg_build(lc[p], pL, pM);
		seg_build(rc[p], pM + 1, pR);
	}
}

void seg_add(int p, int pL, int pR, int qL, int qR, int v)
{
	if (qL <= pL && qR >= pR)
	{
		addEdge(v, p);
		return;
	}

	int pM = pL + pR >> 1;
	if (qL <= pM)
		seg_add(lc[p], pL, pM, qL, qR, v);
	if (qR > pM)
		seg_add(rc[p], pM + 1, pR, qL, qR, v);
}

struct node
{
	int x, v;
	node() {}
	node(const int &_x, const int &_v)
		: x(_x), v(_v) {}

	friend inline bool operator<(const node &lhs, const node &rhs)
	{
		if (lhs.x != rhs.x)
			return lhs.x < rhs.x;
		return lhs.v < rhs.v;
	}
};
node p[MaxM + 1];

inline bool validate(int d)
{
	adj_tail = adj_pool;
	for (int u = 1; u <= seg_n; ++u)
		adj[u] = NULL;

	for (int u = 1; u <= seg_n; ++u)
	{
		if (lc[u] > 0)
			addEdge(u, lc[u]);
		if (rc[u] > 0)
			addEdge(u, rc[u]);
	}

	int l = 1, r = 1;
	for (int i = 1; i <= m; ++i)
	{
		while (p[i].x - p[l].x >= d)
			++l;
		while (r < m && p[r + 1].x - p[i].x < d)
			++r;

		int v = ver[p[i].v];
		if (l < i)
			seg_add(1, 1, m, l, i - 1, v);
		if (i < r)
			seg_add(1, 1, m, i + 1, r, v);
	}

	scc_n = sta_n = dfs_clock = 0;
	for (int u = 1; u <= seg_n; ++u)
		dfn[u] = low[u] = sccNum[u] = 0;
	for (int u = 1; u <= seg_n; ++u)
		if (!dfn[u])
			dfs(u);

	for (int i = 1; i <= n; ++i)
		if (sccNum[ver[vl[i]]] == sccNum[ver[vr[i]]])
			return false;
	return true;
}

int main()
{
	cin >> n, m = n * 2;
	for (int i = 1; i <= n; ++i)
	{
		int x = getint(), y = getint();
		p[i * 2 - 1] = {x, i};
		p[i * 2 - 0] = {y, i};
	}

	sort(p + 1, p + m + 1);

	for (int i = 1; i <= m; ++i)
		vl[p[i].v] ? vr[p[i].v] = i : vl[p[i].v] = i;
	for (int i = 1; i <= n; ++i)
		p[vl[i]].v = vr[i], p[vr[i]].v = vl[i];

	seg_build(1, 1, m);

	int l = 1, r = INF;
	while (l <= r)
	{
		int mid = l + r >> 1;
		if (validate(mid))
			l = mid + 1;
		else
			r = mid - 1;
	}

	cout << r << endl;

	return 0;
}

Measured memory_bytes: 16768