/************************************************
 * Au: Hany01
 * Date: Aug 31st, 2018
 * Prob: ARC069F Flags
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
#define rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define x first
#define y second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

inline int read() {
	static int _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

const int maxn = 8e4 + 5, maxm = 1e6;

int n, tot, v[maxm], nex[maxm], beg[maxn], e, nt, dfn[maxn], low[maxn], isin[maxn], cocnt, co[maxn], stk[maxn], top, tot_, clk, pos[maxn], lc[maxn], rc[maxn], rt;
PII p[maxn];

#define mid ((l + r) >> 1)

inline void add(int uu, int vv) { if (uu != vv) v[++ e] = vv, nex[e] = beg[uu], beg[uu] = e; }

void build(int& rt, int l, int r) {
	if (l == r) { rt = l; return; }
	rt = ++ tot, build(lc[rt], l, mid), build(rc[rt], mid + 1, r);
	add(lc[rt], rt), add(rc[rt], rt);
}

void Add(int t, int l, int r, int x, int y) {
	if (x <= p[l].x && p[r].x <= y && (pos[p[nt].y ^ 1] < l || pos[p[nt].y ^ 1] > r)) add(t, nt);
	else {
        if (l == r) return;
		if (p[mid].x >= x) Add(lc[t], l, mid, x, y);
		if (p[mid + 1].x <= y) Add(rc[t], mid + 1, r, x, y);
	}
}

void DFS(int u) {
	dfn[u] = low[u] = ++ clk, isin[u] = 1, stk[++ top] = u;
	for (register int i = beg[u]; i; i = nex[i]) {
		if (!dfn[v[i]]) DFS(v[i]), chkmin(low[u], low[v[i]]);
		else if (isin[v[i]]) chkmin(low[u], dfn[v[i]]);
	}
	if (dfn[u] == low[u]) {
		++ cocnt;
		do isin[stk[top]] = 0, co[stk[top]] = cocnt; while (stk[top --] != u);
	}
}

int viss[maxn];
void Debug(int u, int pa = 0) {
    viss[u] = 1;
    for (register int i = beg[u]; i; i = nex[i])
        if (!viss[v[i]]) Debug(v[i], u);
}

inline bool check(int maxd) {
	e = 0, Set(beg, 0), tot = tot_, build(rt, 2, tot_);
	For(i, 2, tot_) {
		int l = p[i].x - maxd + 1, r = p[i].x + maxd - 1;
		nt = pos[p[i].y ^ 1];
		if (l <= r) Add(rt, 2, tot_, l, r);
	}
	Set(dfn, 0), clk = cocnt = 0;
	For(i, 2, tot_) if (!dfn[i]) DFS(i);
    Debug(2);
	For(i, 1, n) if (co[pos[i << 1]] == co[pos[i << 1 | 1]]) return 0;
	return 1;
}

#undef mid

int main()
{
#ifdef hany01
	freopen("arc069f.in", "r", stdin);
	freopen("arc069f.out", "w", stdout);
#endif

	tot = (n = read()) << 1 | 1;
	For(i, 1, n) p[i << 1] = mp(read(), i << 1), p[i << 1 | 1] = mp(read(), i << 1 | 1);
	sort(p + 2, p + 1 + tot), tot_ = tot;
	For(i, 2, tot) pos[p[i].y] = i;

	static int l = 0, r = p[tot].x, mid;
	while (l < r) if (check(mid = (l + r + 1) >> 1)) l = mid; else r = mid - 1;
	printf("%d\n", l);

	return 0;
}


Measured memory_bytes: 10624