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

template<class T>
struct SegmentTree {
	using F = function<T(T, T)>;
	const T init;
	const F f;
	int sz;
	vector<T> seg;
	SegmentTree(int n, const T init, const F f) :
		init(init),
		f(f)
		{
			sz = 1;
			while(sz < n) sz <<= 1;
			seg.resize(sz << 1, init);
		}
	void update(int id) {
		while(id >>= 1) {
			seg[id] = f(seg[2 * id], seg[2 * id + 1]);
		}
	}
	void replace(int id, T x){
		id += sz;
		seg[id] = x;
		update(id);
	}
	// [l,r)
	T get(int l, int r){
		T L = init, R = init;
		for(l += sz, r += sz; l < r; l >>= 1, r>>= 1) {
			if(l & 1) L = f(L, seg[l++]);
			if(r & 1) R = f(seg[--r], R);
		}
		return f(L, R);
	}
	void debug(){
		int i = 1;
		for(int r = 2; r <= 2 * sz; r <<= 1) {
			while(i < r) {
				cout << seg[i++] << " ";
			}
			cout << "\n";
		}
	}
};


struct StronglyConnectedComponent {
	int V;
	vector<vector<int>> G, revG;
	vector<int> id;
	StronglyConnectedComponent(const int V) :
		V(V),
		G(vector<vector<int>>(V, vector<int>())),
		revG(vector<vector<int>>(V, vector<int>())),
		id(vector<int>(V))
		{}
	void addEdge(int from, int to) {
		G[from].push_back(to);
		revG[to].push_back(from);
	}
	void build() {
		vector<bool> used(V, false);
		stack<int> st;
		for(int from = 0; from < V; ++from) {
			if(not used[from]) {
				dfs(from, used, st);
			}
		}
		int num = 0;
		while(st.size()) {
			int from = st.top();
			st.pop();
			if(used[from]) {
				revdfs(from, num, used);
				++num;
			}
		}
	}
	void dfs(int from, vector<bool> &used, stack<int> &st) {
		used[from] = true;
		for(int to : G[from]) {
			if(not used[to]) {
				dfs(to, used, st);
			}
		}
		st.push(from);
	}
	void revdfs(int from, int num, vector<bool> &used) {
		used[from] = false;
		id[from] = num;
		for(int to : revG[from]) {
			if(used[to]) {
				revdfs(to, num, used);
			}
		}
	}
	int get(int x) {
		return id[x];
	}
};

struct TwoSatisfiability {
	const int V;
	vector<vector<int>> G;
	vector<bool> pos;
	StronglyConnectedComponent scc;
	TwoSatisfiability(const int V) :
		V(V),
		G(vector<vector<int>>(2 * V, vector<int>())),
		pos(vector<bool>(2 * V)),
		scc(StronglyConnectedComponent(2 * V))
		{}
	inline int NOT(int A) {
		return (A + V) % (2 * V);
	}
	// A -> B <=> not B -> not A
	inline void addIF(int A, bool Apos, int B, bool Bpos) {
		if(not Apos) A = NOT(A);
		if(not Bpos) B = NOT(B);
		scc.addEdge(A, B); // A -> B
		scc.addEdge(NOT(B), NOT(A)); // not B -> not A
	}
	// A <=> (not A -> A)
	void addUNARY(int A, bool Apos) {
		addIF(A, not Apos, A, Apos); // not A -> A
	}
	// A or B <=> not A -> B
	void addOR(int A, bool Apos, int B, bool Bpos) {
		addIF(A, not Apos, B, not Bpos); // not A -> B
	}
	// not(A and B) => A -> not B
	void addNAND(int A, bool Apos, int B, bool Bpos) {
		addIF(A, Apos, B, not Bpos); // A -> not B
	}
	// A xor B <=> not(A and B) and not(not A and not B)
	void addXOR(int A, bool Apos, int B, bool Bpos) {
		addNAND(A, Apos, B, Bpos); // not(A and B)
		addNAND(A, not Apos, B, not Bpos); // not(not A and not B)
	}
	// not(A xor B) <=> A xor not B
	void addXNOR(int A, bool Apos, int B, bool Bpos) {
		addXOR(A, Apos, B, not Bpos); // A xor not B
	}
	bool solve() {
		scc.build();
		for(int i = 0; i < V; ++i) {
			if(scc.get(i) == scc.get(i + V)) {
				return false;
			}
			pos[i] = (scc.get(i) > scc.get(i + V));
		}
		return true;
	}
	bool get(int x) {
		return pos[x];
	}
};

void add(int id, int l, int r, TwoSatisfiability &sat) {
	id += sat.V / 2;
	for(l += sat.V / 2, r += sat.V / 2; l < r; l >>= 1, r >>= 1) {
		if(l & 1) {
			sat.addNAND(id, true, l, true);
			// cerr << "NAND : " << id << " " << l << endl;
			++l;
		}
		if(r & 1) {
			--r;
			sat.addNAND(id, true, r, true);
			// cerr << "NAND : " << id << " " << r << endl;
		}
	}
}

bool bisearch(int d, vector<pair<int, int>> &z, TwoSatisfiability sat) {
	const int N = z.size();
	for(int i = 0; i < N; ++i) {
		int x = z[i].first;
		int r = lower_bound(z.begin(), z.end(), make_pair(x + d, -1)) - z.begin();
		// cerr << i << " : [" << i + 1 << ", " << r << ")" << endl;
		add(i, i + 1, r, sat);
	}
	return sat.solve();
}

int main() {
	int n; cin >> n;
	int x[n], y[n];
	const int N = 2 * n;
	vector<pair<int, int>> z(N);
	for(int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
		z[2 * i] = {x[i], i};
		z[2 * i + 1] = {y[i], i};
	}
	sort(z.begin(), z.end());
	int sz = 1;
	while(sz < N) sz <<= 1;
	TwoSatisfiability sat(sz << 1);
	vector<int> idx(N, -1);
	for(int i = 0; i < N; ++i) {
		if(idx[z[i].second] == -1) {
			idx[z[i].second] = i;
		} else {
			int j = idx[z[i].second];
			sat.addXOR(i + sz, true, j + sz, true);
			// cerr << "XOR : " << i + sz << " " << j + sz << endl;
		}
	}
	for(int i = 1; i < sz; ++i) {
		sat.addIF(2 * i, true, i, true);
		// // cerr << "IF : " << 2 * i << " " << i << endl;
		sat.addIF(2 * i + 1, true, i, true);
		// // cerr << "IF : " << 2 * i + 1 << " " << i << endl;
	}
	int ok = 0, ng = 1e9 + 10;
	while(abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;
		if(bisearch(mid, z, sat)) {
			ok = mid;
		} else {
			ng = mid;
		}
	}
	cout << ok << '\n';
	return 0;
}


Measured memory_bytes: 44172