// Ho-kago Tea Time

#include <bits/stdc++.h>

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

struct flag
{
	int x, y;

	flag() { }
	flag(int _x, int _y): x(_x), y(_y) { }
};

const int MAXN = (int) 1e4;

int n;

flag a[MAXN + 5];

inline void input()
{
	n = read<int>();
	for(int i = 1; i <= n; ++i) a[i].x = read<int>(), a[i].y = read<int>();
}

pii vals[MAXN * 2 + 5];
int M;

inline void discrete()
{
	M = 0;
	for(int i = 1; i <= n; ++i)
	{
		vals[++M] = mp(a[i].x, +i);
		vals[++M] = mp(a[i].y, -i);
	}
	sort(vals + 1, vals + M + 1), M = unique(vals + 1, vals + M + 1) - vals - 1;

	for(int i = 1; i <= n; ++i)
	{
		a[i].x = lower_bound(vals + 1, vals + M + 1, mp(a[i].x, +i)) - vals;
		a[i].y = lower_bound(vals + 1, vals + M + 1, mp(a[i].y, -i)) - vals;
	}
}

namespace GRAPH
{
	const int MAXV = (int) 2e6;

	int N = 0;
	vector<int> adj[MAXV + 5];

	int dfn[MAXV + 5], low[MAXV + 5], dfn_cur, id[MAXV + 5], cnt;
	int stk[MAXV + 5], top, in_stk[MAXV + 5];

	inline void dfs(int u)
	{
		dfn[u] = low[u] = ++dfn_cur;

		in_stk[stk[++top] = u] = 1;
		for(auto v : adj[u])
			if(!dfn[v])
			{
				dfs(v);
				chkmin(low[u], low[v]);
			}
			else if(in_stk[v] && dfn[v] < dfn[u]) chkmin(low[u], dfn[v]);

		if(low[u] >= dfn[u])
		{
			++cnt;
			while(top > 0)
			{
				int p = stk[top--];
				in_stk[p] = 0;
				id[p] = cnt;
				if(p == u) break;
			}
		}
	}

	inline void find_SCC()
	{
		dfn_cur = top = cnt = 0;
		for(int i = 1; i <= N; ++i) dfn[i] = low[i] = id[i] = in_stk[i] = 0;
		for(int i = 1; i <= N; ++i) if(!dfn[i]) dfs(i);
	}
}
using GRAPH::N;
using GRAPH::adj;
using GRAPH::id;

int x[MAXN + 5], y[MAXN + 5];

namespace SEGT
{
	const int MAX_NODE = MAXN * 4 * 2;

	int nd[MAX_NODE + 5], lc[MAX_NODE + 5], rc[MAX_NODE + 5], cnt;

	inline int build(int l, int r)
	{
		int u = ++cnt;
		nd[u] = ++N;
		if(l == r) return u;

		int mid = (l + r) / 2;
		adj[nd[u]].push_back(nd[lc[u] = build(l, mid)]);
		adj[nd[u]].push_back(nd[rc[u] = build(mid + 1, r)]);
		return u;
	}

	inline void insert(int u, int l, int r, int pos, int v)
	{
		if(l == r)
		{
			adj[nd[u]].push_back(v);
			return;
		}

		int mid = (l + r) / 2;
		if(pos <= mid) insert(lc[u], l, mid, pos, v);
		else insert(rc[u], mid + 1, r, pos, v);
	}

	inline void update(int u, int l, int r, int ql, int qr, int v)
	{
		if(ql <= l && r <= qr)
		{
			adj[v].push_back(nd[u]);
			return;
		}

		int mid = (l + r) / 2;
		if(ql <= mid) update(lc[u], l, mid, ql, qr, v);
		if(mid < qr) update(rc[u], mid + 1, r, ql, qr, v);
	}
}

int rt;

inline bool check(int lim)
{
	for(int i = 1; i <= n; ++i) adj[x[i]].clear(), adj[y[i]].clear();
	for(int i = 1; i <= n; ++i)
	{
		int l, r;

		l = lower_bound(vals + 1, vals + M + 1, mp(vals[a[i].x].fst - lim + 1, -n)) - vals;
		r = upper_bound(vals + 1, vals + M + 1, mp(vals[a[i].x].fst + lim - 1, +n)) - vals - 1;
		if(l < a[i].x) SEGT::update(rt, 1, M, l, a[i].x - 1, x[i]);
		if(a[i].x < r) SEGT::update(rt, 1, M, a[i].x + 1, r, x[i]);

		l = lower_bound(vals + 1, vals + M + 1, mp(vals[a[i].y].fst - lim + 1, -n)) - vals;
		r = upper_bound(vals + 1, vals + M + 1, mp(vals[a[i].y].fst + lim - 1, +n)) - vals - 1;
		if(l < a[i].y) SEGT::update(rt, 1, M, l, a[i].y - 1, y[i]);
		if(a[i].y < r) SEGT::update(rt, 1, M, a[i].y + 1, r, y[i]);
	}

	GRAPH::find_SCC();
	for(int i = 1; i <= n; ++i) if(id[x[i]] == id[y[i]]) return 0;
	return 1;
}

inline void solve()
{
	discrete();

	rt = SEGT::build(1, M);
	for(int i = 1; i <= n; ++i)
	{
		x[i] = ++N, y[i] = ++N;
		SEGT::insert(rt, 1, M, a[i].x, y[i]);
		SEGT::insert(rt, 1, M, a[i].y, x[i]);
	}

	int l = 0, r = (int) 1e9;
	while(l < r)
	{
		int mid = (l + r + 1) / 2;
		if(check(mid)) l = mid;
		else r = mid - 1;
	}
	printf("%d\n", l);
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



Measured memory_bytes: 67712