#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
const int MAXN = 12000;
int en[MAXN * 20];
int was[MAXN * 20];
vector<int> eds[MAXN * 20];
vector<int> reds[MAXN * 20];
int n;
vector<pair<ll, int> > vv;
ll x[MAXN];
ll y[MAXN];
vector<int> vvv;
int cl[MAXN * 20];

void dfs1(int v) {
	was[v] = 1;
	for (int u: eds[v])
		if (!was[u])
			dfs1(u);
	vvv.push_back(v);
}

void dfs2(int v, int c) {
	was[v] = 2;
	cl[v] = c;
	for (int u: reds[v]) {
		if (was[u] != 2)
			dfs2(u, c);
	}
}

void add(int v, int tl, int tr, int l, int r, int x) {
	if (r <= tl || tr <= l)
		return;
	if (l <= tl && tr <= r) {
		eds[x].push_back(v + 2 * n);
		eds[v + 2 * n + 4 * vv.size()].push_back(x ^ 1);
		return;
	}
	int m = (tl + tr) >> 1;
	add(v * 2 + 1, tl, m, l, r, x);
	add(v * 2 + 2, m, tr, l, r, x);
}

void build(int v, int tl, int tr) {
	if (tl + 1 == tr) {
		eds[v + 2 * n].push_back(vv[tl].second);
		eds[vv[tl].second ^ 1].push_back(v + 2 * n + 4 * vv.size());
		return;
	}
	int m = (tl + tr) >> 1;
	eds[v + 2 * n].push_back(2 * v + 1 + 2 * n);
	eds[v + 2 * n].push_back(2 * v + 2 + 2 * n);
	eds[2 * v + 1 + 2 * n + 4 * vv.size()].push_back(v + 2 * n + 4 * vv.size());
	eds[2 * v + 2 + 2 * n + 4 * vv.size()].push_back(v + 2 * n + 4 * vv.size());
	build(v * 2 + 1, tl, m);
	build(v * 2 + 2, m, tr);
}

int check(ll d) {
	for (int i = 0; i < 2 * n + 8 * vv.size(); ++i)
		eds[i].clear(), reds[i].clear();
	build(0, 0, vv.size());
	for (int i = 0; i < n; ++i) {
		int l = lower_bound(vv.begin(), vv.end(), make_pair(x[i] - d + 1, 0)) - vv.begin();
		int r = lower_bound(vv.begin(), vv.end(), make_pair(x[i], 2 * i + 1)) - vv.begin();
		if (l < r)
			add(0, 0, vv.size(), l, r, 2 * i);
		l = lower_bound(vv.begin(), vv.end(), make_pair(x[i], 2 * i + 2)) - vv.begin();
		r = lower_bound(vv.begin(), vv.end(), make_pair(x[i] + d, 0)) - vv.begin();
		if (l < r)
			add(0, 0, vv.size(), l, r, 2 * i);
		l = lower_bound(vv.begin(), vv.end(), make_pair(y[i] - d + 1, 0)) - vv.begin();
		r = lower_bound(vv.begin(), vv.end(), make_pair(y[i], 2 * i)) - vv.begin();
		if (l < r)
			add(0, 0, vv.size(), l, r, 2 * i + 1);
		l = lower_bound(vv.begin(), vv.end(), make_pair(y[i], 2 * i + 1)) - vv.begin();
		r = lower_bound(vv.begin(), vv.end(), make_pair(y[i] + d, 0)) - vv.begin();
		if (l < r)
			add(0, 0, vv.size(), l, r, 2 * i + 1);
	}
	vvv.clear();
	for (int i = 0; i < 2 * n + 8 * vv.size(); ++i) {
		for (int u: eds[i])
			reds[u].push_back(i);
		en[i] = 0, was[i] = 0;
	}
	for (int i = 0; i < 2 * n; ++i) {
		if (!was[i])
			dfs1(i);
	}
	reverse(vvv.begin(), vvv.end());
	int c = 0;
	for (int i = 0; i < vvv.size(); ++i) {
		if (was[vvv[i]] != 2)
			dfs2(vvv[i], c++);
	}
	for (int i = 0; i < n; ++i) {
		if (cl[2 * i] == cl[2 * i + 1])
			return 0;
	}
	return 1;
}

ll solve() {
	vv.clear();
	for (int i = 0; i < n; ++i)
		vv.push_back(make_pair(x[i], 2 * i + 1));
	for (int i = 0; i < n; ++i)
		vv.push_back(make_pair(y[i], 2 * i));
	sort(vv.begin(), vv.end());
	ll l = 0;
	ll r = 1e9 + 100;
	while (r - l > 1) {
		ll mid = (l + r) >> 1;
		if (check(mid))
			l = mid;
		else
			r = mid;
	}
	return l;
}

ll x2[MAXN];
ll y2[MAXN];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%lld%lld", x + i, y + i);
	ll ans = solve();
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 46456