#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <assert.h>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
#include <complex>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
using namespace std;

#define int64 long long
#define mp make_pair
#ifdef _DEBUG
const int N = 500;
#else
const int N = 100000;
#endif

int n, m, ng, cur, x[N], y[N], num[N], num1[N], comp[N];
int status[N];
pair <int, int> p[N];
vector <int> points[N];
vector <int> g[N], gt[N];
vector <int> order;

void compress()
{
	for (int i = 1; i <= n; i++) p[i] = mp(x[i], i);
	for (int i = 1; i <= n; i++) p[i + n] = mp(y[i], i + n);
	sort(p + 1, p + 2 * n + 1);
	int val = 0;
	for (int i = 1; i <= 2 * n; i++)
	{
		if (i == 1 || p[i].first != p[i - 1].first) val++;
		if (p[i].second <= n) x[p[i].second] = val;
		else y[p[i].second - n] = val;
	}
	m = 2 * n;
}

void setnums(int v, int tl, int tr)
{
	ng++;
	num[v] = ng;
	if (tl == tr)
	{
		num1[tl] = ng;
		return;
	}
	int tm = (tl + tr) / 2;
	setnums(v * 2, tl, tm);
	setnums(v * 2 + 1, tm + 1, tr);
}

void clear()
{
	for (int i = 1; i <= ng; i++) 
	{
		g[i].clear();
		gt[i].clear();
	}
}

void addEdge(int u, int v)
{
	g[u].push_back(v);
	gt[v].push_back(u);
}

void addEdgesToTree(int v, int tl, int tr)
{
	if (tl == tr) return;
	int tm = (tl + tr) / 2;
	addEdge(num[v], num[v * 2]);
	addEdge(num[v], num[v * 2 + 1]);
	addEdgesToTree(v * 2, tl, tm);
	addEdgesToTree(v * 2 + 1, tm + 1, tr);
}

int findLeft(int x)
{
	if (p[m].first < x) return -1;
	int l = 1, r = m;
	while (l + 1 < r)
	{
		int mid = (l + r) / 2;
		if (p[mid].first < x) l = mid + 1;
		else r = mid;
	}
	if (p[l].first >= x) return l;
	return r;
}

int findRight(int x)
{
	if (p[1].first > x) return -1;
	int l = 1, r = m;
	while (l + 1 < r)
	{
		int mid = (l + r) / 2;
		if (p[mid].first > x) r = mid - 1;
		else l = mid;
	}
	if (p[r].first <= x) return r;
	return l;
}

void addseg(int v, int u, int tl, int tr, int l, int r)
{
	if (l > r) return;
	if (l == tl && r == tr)
	{
		addEdge(u, num[v]);
		return;
	}
	int tm = (tl + tr) / 2;
	addseg(v * 2, u, tl, tm, l, min(r, tm));
	addseg(v * 2 + 1, u, tm + 1, tr, max(l, tm + 1), r);
}


void update(int x, int d, int u)
{
	int l = p[x].first - (d - 1);
	int r = p[x].first + (d - 1);
	l = findLeft(l);
	r = findRight(r);
	if (l != -1) addseg(1, u, 1, m, l, x - 1);
	if (r != -1) addseg(1, u, 1, m, x + 1, r);
}

void addEdges(int d)
{
	clear();
	addEdgesToTree(1, 1, m);
	for (int i = 1; i <= m; i++)
	{
		int j = p[i].second;
		if (j <= n) j += n;
		else j -= n;
		addEdge(num1[i], j);
	}
	for (int i = 1; i <= m; i++)
	{
		update(i, d, p[i].second);
	}
}

void dfs1(int v)
{
	status[v] = 1;
	for (int i = 0; i < g[v].size(); i++)
		if (!status[g[v][i]])
			dfs1(g[v][i]);
	order.push_back(v);
	status[v] = 2;
}

void dfs2(int v)
{
	comp[v] = cur;
	status[v] = 1;
	for (int i = 0; i < gt[v].size(); i++)
		if (!status[gt[v][i]])
			dfs2(gt[v][i]);
	status[v] = 2;
}

bool check(int d)
{
	addEdges(d);
	order.clear();
	for (int i = 1; i <= ng; i++) status[i] = 0;
	cur = 0;
	for (int i = 1; i <= ng; i++)
		if (!status[i])
		{
			dfs1(i);
		}
	reverse(order.begin(), order.end());
	for (int i = 1; i <= ng; i++) status[i] = 0;
	for (int i = 0; i < order.size(); i++)
		if (!status[order[i]])
		{
			cur++;
			dfs2(order[i]);
		}
	for (int i = 1; i <= n; i++)
		if (comp[i] == comp[i + n]) return false;
	return true;
}

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
	for (int i = 1; i <= n; i++)
		if (x[i] > y[i]) swap(x[i], y[i]);
	compress();
	for (int i = 1; i <= n; i++)
	{
		points[x[i]].push_back(i + n);
		points[y[i]].push_back(i);
	}
	ng = 2 * n;
	setnums(1, 1, m);
	int l = 0, r = 1e9;
	while (l + 1 < r)
	{
		int mid = (l + r) / 2;
		if (check(mid)) l = mid;
		else r = mid - 1;
	}
	int ans;
	if (check(r)) ans = r;
	else ans = l;
	cout << ans;
	return 0;
}

Measured memory_bytes: 26108