#include<bitset>
#include<stack>
#include<queue>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}


const int SIZE = 1<<15;
namespace SCC {
const int MAXN = SIZE*2; // TODO: check the maximum size;
typedef vector<VI> Adj;
const VI *g;
int n;
int scc[MAXN]; // scc[v] := v's index of shrinked graph; topological order;
int cnt; // size of shrinked graph;
int num[MAXN]; // num[v] := dfs position of v;
int low[MAXN];
int par[MAXN];
int iter[MAXN];
int st[MAXN], st_i;
int vis[MAXN], vis_i;
bool in_vis[MAXN];

int build(const VI *g_, int n_) { // HINT: Adj G(N); build(&G[0], N);
    g = g_;
    n = n_;
    memset(scc, -1, sizeof (int) * n);
    cnt = 0;
    memset(num, -1, sizeof (int) * n);
    memset(low, -1, sizeof (int) * n);
    memset(par, -1, sizeof (int) * n);
    memset(iter, 0, sizeof (int) * n);
    st_i = 0;
    vis_i = 0;
    memset(in_vis, 0, sizeof (bool) * n);

    int time = 0;

    REP (s, n) if (scc[s] == -1) {
	st[st_i++] = s;
	while (st_i) {
	    int v = st[st_i-1];
	    if (num[v] == -1) {
		low[v] = num[v] = time++;
		vis[vis_i++] = v; in_vis[v] = true;
	    }

	    if (iter[v]) {
		int w = g[v][iter[v]-1];
		if (v == par[w]) amin(low[v], low[w]);
		else if (in_vis[w]) amin(low[v], num[w]);
	    }

	    if (iter[v] < (int)g[v].size()) {
		int w = g[v][iter[v]++];
		if (num[w] == -1) {
		    par[w] = v;
		    st[st_i++] = w;
		}
	    } else {
		st_i--;
		if (low[v] == num[v]) {
		    while (1) {
			int w = vis[--vis_i]; in_vis[w] = false;
			scc[w] = cnt;
			if (v == w) break;
		    }
		    cnt++;
		}
	    }
	}
    }
    REP (v, n) scc[v] = cnt - 1 - scc[v];
    return cnt;
}

}; // namespace SCC;
VI G[SIZE*2];
int N, N2;
int X[10011], Y[10011];
pair<int, int> P[20011];
int rnk[20011], buddy[20011];

void add(int l, int r, int from) {
    from += SIZE;
    l += SIZE;
    r += SIZE;
    for (; l<r; l>>=1, r>>=1) {
	if (l&1) { G[from].push_back(l); l++; }
	if (r&1) { r--; G[from].push_back(r); }
    }
}

bool ok(int mid) {
    REP (i, SIZE*2) G[i].clear();

    int l = 0;
    int r = 0;
    REP (i, N2) {
	while (r < N2 && P[r].first - P[i].first < mid) r++;
	while (l < i && P[i].first - P[l].first >= mid) l++;
	if (i+1 < r) {
	    add(i+1, r, buddy[i]);
	}
	if (l < i) {
	    add(l, i, buddy[i]);
	}
    }

    for (int v=SIZE; --v;) {
	G[v].push_back(v*2);
	G[v].push_back(v*2+1);
    }

    SCC::build(G, SIZE*2);
    REP (i, N2) if (SCC::scc[i+SIZE] == SCC::scc[buddy[i]+SIZE]) return false;
    return true;
}

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d%d", X+i, Y+i);

#ifdef LOCAL
    N = 10000;
    REP (i, N) {
	X[i] = i;
	Y[i] = i+N;
	X[i] = rand();// % 1000000000;
	Y[i] = rand();// % 1000000000;
    }
#endif

    N2 = N+N;
    REP (i, N) {
	P[i] = make_pair(X[i], i);
	P[i+N] = make_pair(Y[i], i+N);
    }
    sort(P, P+N2);
    REP (i, N2) {
	rnk[P[i].second] = i;
    }
    REP (i, N2) {
	buddy[i] = rnk[(P[i].second+N) % N2];
    }

    int lo = 0, hi = 1000000001;
    while (hi - lo > 1) {
	int mid = (lo + hi) / 2;
	(ok(mid)? lo: hi) = mid;
    }
    printf("%d\n", lo);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 9344