#include <bits/stdc++.h> 
using namespace std;

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

int const MAX = 1e5 + 41;
int const INF = 1e9 + 41;

int n;
int x[MAX];
int y[MAX];

vi e[MAX * 4];
vi et[MAX * 4];
int cnt;



int col[MAX * 4];
int timer;
int u[MAX * 4];
int order[MAX * 4];

void dfs(int x) {
	u[x] = 1;
	for (int y : e[x]) {
		if (u[y]) continue;
		dfs(y);
	}
	timer++;
	order[timer] = x;
}

void dfst(int x, int color) {
	col[x] = color;
	u[x] = 1;
	for (int y : et[x]) {
		if (u[y]) continue;
		dfst(y, color);
	}
}

void findcomps() {
	int color = 0;
	fi(1, cnt - 1) {
		for (int y : e[i]) {
			et[y].pb(i);
		}
	}
	timer = 0;
	memset(u, 0, sizeof(u));
	fi(1, cnt) {
		if (!u[i]) {
			dfs(i);
		}
	}
	memset(u, 0, sizeof(u));
	fdi(timer, 1) {
		if (!u[order[i]]) {
			color++;
			dfst(order[i], color);
		}
	}
}

struct Variable {
	int tid, fid;
	Variable () {	};
};

Variable getvariable() {
	Variable res;
	res.tid = cnt;
	cnt++;
	res.fid = cnt;
	cnt++;
	return res;
}

Variable t[MAX * 4];

void clear() {
	cnt = 1;
	fi(0, MAX * 4 - 1) {
		e[i].clear();
		et[i].clear();
	}
}

void build(int v, int tl, int tr) {
	if (tl == tr) {
		t[v] = getvariable();
	} else {
		int tm = (tl + tr) / 2;
		build(v * 2 + 1, tl, tm);
		build(v * 2 + 2, tm + 1, tr);
		t[v] = getvariable();
	}
}

void place(int v, int tl, int tr, int l, int r, vector<Variable> &resp) {
	if (tl > r || l > tr) return;
	if (l <= tl && tr <= r) {
		resp.pb(t[v]);
		return;
	}
	int tm = (tl + tr) / 2;
	place(v * 2 + 1, tl, tm, l, r, resp);
	place(v * 2 + 2, tm + 1, tr, l, r, resp);
}

void godown(int v, int tl, int tr, int p, Variable x) {
	if (tl == tr) return;
	e[t[v].tid].pb(x.tid);
	e[t[v].fid].pb(x.fid);
	int tm = (tl + tr) / 2;
	if (p <= tm) {
		godown(v * 2 + 1, tl, tm, p, x);
	} else {
		godown(v * 2 + 2, tm + 1, tr, p, x);
	}
}

pii a[MAX];

int pos[MAX][2];

bool checkall(int v, int tl, int tr) {
	if (tl == tr) {
		return col[t[v].tid] != col[t[v].fid];
	}
	int tm = (tl + tr) / 2;
	bool res = (checkall(v * 2 + 1, tl, tm) && checkall(v * 2 + 2, tm + 1, tr));
	return res;
}

void dbg(int v, int tl, int tr) {
	err("tl = %d tr = %d tid = %d fid = %d\n", tl, tr, t[v].tid, t[v].fid);
	if (tl == tr) return;
	int tm = (tl + tr) / 2;
	dbg(v * 2 + 1, tl, tm);
	dbg(v * 2 + 2, tm + 1, tr);
}

bool can(int h) {
	clear();		
	build(0, 1, n * 2);
	fi(1, n * 2) {
		vector<Variable> cur;
		place(0, 1, n * 2, i, i, cur);
		godown(0, 1, n * 2, i, cur[0]);
	}
	
	memset(pos, 0, sizeof(pos));
	fi(1, n) {
		a[i] = mp(x[i], i);
		a[i + n] = mp(y[i], i);
	}

	sort(a + 1, a + n * 2 + 1);
	fi(1, n * 2) {
		int pt = a[i].second;
		if (pos[pt][0]) {
			pos[pt][1] = i;
		} else {
			pos[pt][0] = i;
		}
	}

	fi(1, n) {//!x_i -> y_i, !y_i -> x_i
		int a = pos[i][0];
		int b = pos[i][1];
		vector<Variable> va, vb;
		place(0, 1, n * 2, a, a, va);
		place(0, 1, n * 2, b, b, vb);
		e[va[0].fid].pb(vb[0].tid);
		e[vb[0].fid].pb(va[0].tid);
	}

	fi(1, n * 2) {
		int lx = a[i].first - h;
		int rx = a[i].first + h;
		int l = (int) (upper_bound(a + 1, a + n * 2 + 1, mp(lx, INF)) - a);
		int r = (int) (upper_bound(a + 1, a + n * 2 + 1, mp(rx, -INF)) - a);
		r--;
//		err("i = %d lx = %d rx = %d l = %d r = %d\n", i, lx, rx, l, r);
		
		vector<Variable> cur;
		place(0, 1, n * 2, i, i, cur);	

		vector<Variable> v;
		place(0, 1, n * 2, l, i - 1, v);
		for (auto z : v) {
			e[cur[0].tid].pb(z.fid);
		}
		place(0, 1, n * 2, i + 1, r, v);
		for (auto z : v) {
			e[cur[0].tid].pb(z.fid);
		}
	}

	findcomps();
	/*
	dbg(0, 1, n * 2);
	
	fi(1, cnt) {
		err("i = %d color = %d\n", i, col[i]);
	}
	*/
	return checkall(0, 1, n * 2);
}

void solve() {

	int l = -1;
	int r = INF;
	while (r - l > 1) {
		int h = (l + r) / 2;
		if (can(h)) {
			l = h;
		} else {
			r = h;
		}
	}
	assert(l >= 0);
	printf("%d\n", l);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

  scanf("%d", &n);
  fi(1, n) {
  	scanf("%d %d", &x[i], &y[i]);
  }
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 53100