#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;

struct Dscc {
public:

	//fst:belongs , scd:newedges
	pair<vector<vector<int>>, vector<vector<int>>>get(const vector<vector<int>>&edges) {
		nums.resize(edges.size());
		fill(nums.begin(), nums.end(), -1);
		vector<vector<int>>revedges(edges.size());
		for (int i = 0; i < edges.size(); ++i) {
			for (auto j : edges[i]) {
				revedges[j].push_back(i);
			}
		}
		int num = 0;
		for (int i = 0; i < edges.size(); ++i) {
			dfs(i, num, edges);
		}
		vector<int>big(nums.size());
		for (int i = 0; i < nums.size(); ++i) {
			big[nums[i]] = i;
		}
		reverse(big.begin(), big.end());
		unis.resize(edges.size());
		fill(unis.begin(), unis.end(), -1);
		num = 0;
		for (int i = 0; i < big.size(); ++i) {

			dfs2(big[i], num, revedges);
			num++;
		}
		vector<int>nums;
		for (int i = 0; i < unis.size(); ++i) {
			nums.push_back(unis[i]);
		}
		sort(nums.begin(), nums.end());
		nums.erase(unique(nums.begin(), nums.end()), nums.end());


		map<int, int>mp;
		for (int i = 0; i < nums.size(); ++i) {
			mp[nums[i]] = i;
		}
		for (int i = 0; i < unis.size(); ++i) {
			unis[i] = mp[unis[i]];
		}

		vector<vector<int>>belongs(nums.size());
		for (int i = 0; i < unis.size(); ++i) {
			belongs[unis[i]].push_back(i);
		}
		vector<vector<int>>newedges(nums.size());
		for (int i = 0; i < edges.size(); ++i) {
			for (auto j : edges[i]) {
				if (unis[i] != unis[j]) {
					newedges[unis[i]].push_back(unis[j]);
				}
			}
		}
		return make_pair(belongs, newedges);
	}
private:
	vector<int>nums;
	vector<int>unis;


	void dfs(const int id, int &num, const vector<vector<int>>&edges) {
		if (nums[id] != -1)return;
		else {
			nums[id] = -2;
			for (auto i : edges[id]) {
				dfs(i, num, edges);
			}
		}
		nums[id] = num++;
		return;
	}
	void dfs2(const int id, const int &num, const vector<vector<int>>&edges) {
		if (unis[id] != -1)return;
		else {
			unis[id] = -2;
			for (auto i : edges[id])
				dfs2(i, num, edges);
		}
		unis[id] = num;
		return;
	}

}dscc;

void dfs(vector<int>&anss,int id,const int a, const int b, const int l, const int r) {
	if(b<=l)return;
	if(r<=a)return;
	if (l <= a&&b <= r) {
		anss.push_back(id);
		return;
	}
	else {
		dfs(anss,id*2+1,a,(a+b)/2,l,r);
		dfs(anss,id*2+2,(a+b)/2,b,l,r);
	}
}

bool solve(const vector<pair<int, int>>&ps, int mid) {
	vector<pair<int,int>>xs;
	for (int i = 0; i < ps.size(); ++i) {
		xs.push_back(make_pair(ps[i].first,i));
		xs.push_back(make_pair(ps[i].second,i));
	}
	sort(xs.begin(),xs.end());
	int kk=1;
	while (kk < xs.size()) {
		kk*=2;
	}
	const int NUM=kk*2-1;
	vector<vector<int>>graph(2*(2*kk-1));
	{
		map<int,vector<int>>mp;
		for (int i = 0; i < xs.size(); ++i) {
			int id=xs[i].second;
			mp[id].push_back(i);
		}
		for (auto m : mp) {
			int id1=m.second[0]+kk-1;
			int id2=m.second[1]+kk-1;

			graph[id1].push_back(id2+ NUM);
			graph[id1+ NUM].push_back(id2);
			graph[id2].push_back(id1 + NUM);
			graph[id2 + NUM].push_back(id1);
		}
	}
	for(int i=0;i<xs.size();++i){
		int my_x=xs[i].first;
		int out_l=xs[i].first-mid+1;
		int out_r=xs[i].first+mid-1;
		auto lt=lower_bound(xs.begin(),xs.end(),make_pair(out_l,int(-1e9)));
		auto rt=upper_bound(xs.begin(),xs.end(),make_pair(out_r,int(1e9)));

		int l_place=lt-xs.begin();
		int r_place=rt-xs.begin();
		vector<int>anss_l;
		dfs(anss_l,0,0,kk,l_place,i);
		vector<int>anss_r;
		dfs(anss_r,0,0,kk,i+1,r_place);

		for (auto ans : anss_l) {
			int id1=i+kk-1;
			int id2=ans;
			graph[id1 + NUM].push_back(id2);
			graph[id2 + NUM].push_back(id1);
		}
		for (auto ans : anss_r) {
			int id1 = i + kk - 1;
			int id2 = ans;
			graph[id1 + NUM].push_back(id2);
			graph[id2 + NUM].push_back(id1);
		}
	}
	for (int i = 1; i < 2 * kk - 1; ++i) {
		int id1=i;
		int id2=(i-1)/2;
		graph[id1+NUM].push_back(id2+NUM);
	}
	auto p=dscc.get(graph);
	vector<int>belongs(graph.size());
	for (int i = 0; i < p.first.size(); ++i) {
		for (auto aa : p.first[i]) {
			belongs[aa]=i;
		}
	}
	bool ok=true;
	for (int i = 0; i < graph.size() / 2; ++i) {
		if(belongs[i]==belongs[i+NUM])ok=false;
	}
	return ok;
}
int main() {
	int N;cin>>N;
	vector<pair<int,int>>flags(N);
	for (int i = 0; i < N; ++i) {
		int a,b;cin>>a>>b;
		flags[i]=make_pair(a,b);
	}
	int amin=0;
	int amax=1e9+1;
	while (amin + 1 != amax) {
		int amid((amin+amax)/2);
		if (solve(flags, amid)) {
			amin=amid;
		}
		else {
			amax=amid;
		}
	}
	cout<<amin<<endl;
	return 0;
}


Measured memory_bytes: 53468