using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Globalization;
using nint=System.Int32;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=new int[n][];
		var c=new (int,int)[n<<1];
		for(int i = 0;i<n;i++) {
			a[i]=sc.Ia;
			c[i<<1]=(a[i][0],i);
			c[(i<<1)+1]=(a[i][1],i);
			a[i][0]=a[i][1]=-1;
		}
		Array.Sort(c,(u,v)=>u.Item1-v.Item1);
		int k=n<<1;
		for(int i = 0;i<k;i++) {
			if(a[c[i].Item2][0]==-1){a[c[i].Item2][0]=i;}
			else{a[c[i].Item2][1]=i;}
		}
		int lb=0,ub=(int)1e9/(n-1)+1,mid=0;
		while(lb+1!=ub){
			mid=(ub+lb)>>1;
			if(!Fu(mid)){ub=mid;}
			else{lb=mid;}
		}
		Console.WriteLine("{0}",lb);
		bool Fu(int m) {
			var sat=new Tsat(k);
			for(int i = 0;i<n;i++) {
				sat.Edge(a[i][0],0,a[i][1],1);
				sat.Edge(a[i][1],1,a[i][0],0);
				sat.Edge(a[i][1],0,a[i][0],1);
				sat.Edge(a[i][0],1,a[i][1],0);
			}
			for(int i = 0,j=0,l=0;i<k;i++) {
				while(j<k&&c[i].Item1+m>c[j].Item1){j++;}
				while(l<i&&c[l].Item1+m<=c[i].Item1){l++;}
				if(i+1<=j-1&&i!=k-1){sat.Edge2(i,i+1,j-1);}
				if(l<=i-1&&i!=0){sat.Edge2(i,l,i-1);}
			}
			sat.Scc();
			for(int i = 0;i<k;i++) {
				if(sat.Ck(i)==-1){return false;}
			}
			return true;
		}
	}
}
public class Tsat{
	public List<int>[] li;
	public int[] h;
	private int n;
	private Stg stg;
	public Tsat(int n){
		this.n=n<<2;
		li=new List<int>[this.n];
		for(int i=0;i<this.n;i++){li[i]=new List<int>();}
		stg=new Stg(li,n<<1,n,true);
		for(int i = 0;i<n;i++) {li[stg.Get(i)].Add((i<<1)+1);}
	}
	public void Edge(int a,int b){
		li[a].Add(b);
	}
	public void Edge(int a,int c,int b,int d){
		a=(a<<1)+c;b=(b<<1)+d;
		li[a].Add(b);
	}
	public void Edge2(int a,int l,int r){
		stg.Edge(a<<1,l,r);
	}
	public int Ck(int a){
		a<<=1;
		return h[a]==h[a+1]?-1:(h[a]<h[a+1]?0:1);
	}
	public void Scc(){
		int n=li.Length,p=1;
		var b=new bool[n];
		var b2=new bool[n];
		var b3=new bool[n];
		var low=new int[n];
		h=new int[n];
		var sk=new Stack<int>();
		var lid=new List<List<int>>();
		for(int i = 0;i<n;i++) {if(!b[i]){Fud(i);}}
		void Fud(int a){
			b[a]=true;
			low[a]=p++;
			sk.Push(a);
			for(int i=0;i<li[a].Count;i++){
				if(b2[li[a][i]]){continue;}
				if(!b[li[a][i]]){Fud(li[a][i]);}
				if(low[a]>low[li[a][i]]){
					low[a]=low[li[a][i]];
					b3[a]=true;
				}
			}
			if(b3[a]){return;}
			int v=-1;
			lid.Add(new List<int>());
			while(v!=a){
				v=sk.Pop();
				lid[lid.Count-1].Add(v);
				b2[v]=true;
				h[v]=lid.Count-1;
			}
		}
	}
}
public class Stg{
	public List<int>[] li;
	public int n,o;
	public Stg(List<int>[] li,int o,int n,bool b){
		this.li=li;
		this.n=n;
		this.o=o;
		for(int i = 1;i<n;i++) {
			li[i+o-1].Add((i<<1)+o-1);
			li[i+o-1].Add((i<<1)+o);
		}
	}
	public void Edge(int a,int l,int r){
		l+=n;r+=n;
		while(l<=r){
			if((l&1)==1){li[a].Add(l+++o-1);}
			if((r&1)==0){li[a].Add(r--+o-1);}
			l>>=1;r>>=1;
		}
	}
	public int Get(int a){return a+n+o-1;}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 85776