#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
int K;
int size;
int ord[2145141];
int X[114514][2];
vector<vector<int>> es[2];
vector<pii> xs;

vector<char> used;
vector<int> vis;
vector<int> belong;

void Dfs(int v) {
  used[v] = true;
  for (int u : es[0][v]) {
    if (used[u]) continue;
    Dfs(u);
  }
  vis.eb(v);
}

void RDfs(int v, int grp) {
  used[v] = true;
  belong[v] = grp;
  for (int u : es[1][v]) {
    if (used[u]) continue;
    RDfs(u, grp);
  }
}

int Neg(int v) {
  if (size <= v && v < K+size) {
    return size + ord[xs[v-size].Y^1];
  } else if (v < size) {
    return K+size + v;
  } else if (K+size <= v) {
    assert(v - K - size < size);
    return v - K - size;
  }

  assert(0);
}

bool DoScc() {
  int m = es[0].size();
  //cout << "m: " << m << endl;
  //cout << "K: " << K << endl;
  //cout << "size: " << size << endl;
  //rep(v, m) {
  //  cout << v << "'s:";
  //  for (int u : es[0][v]) {
  //    cout << " " << u;
  //  }cout << endl;
  //}

  vis.clear();
  belong.assign(m, 0);
  used.assign(m, 0);
  rep(v, m) {
    if (!used[v]) Dfs(v);
  }
  reverse(all(vis));
  used.assign(m, 0);
  int grp = 0;
  for (int v : vis) {
    if (!used[v]) RDfs(v, grp++);
  }

  rep(v, m) {
    assert(Neg(Neg(v)) == v);
    //cout << v << ": " << belong[v] << ", " << belong[Neg(v)] << endl;
    if (belong[v] == belong[Neg(v)]) return false;
  }
  return true;
}

void AddEdge(int u, int v) {
  assert(u != 0);
  assert(v != 0);
  //cout << "(" << u << ", " << v << ")" << endl;
  //cout << "(" << Neg(u) << ", " << Neg(v) << ")" << endl;
  assert(u < es[0].size());
  assert(Neg(u) < es[0].size());
  assert(v < es[1].size());
  assert(Neg(v) < es[1].size());
  es[0][u].eb(v);
  es[1][v].eb(u);
  es[0][Neg(v)].eb(Neg(u));
  es[1][Neg(u)].eb(Neg(v));
}

void AddSegment(int wishl, int wishr, int k, int watchl, int watchr, int u) {
  if (wishr <= watchl || watchr <= wishl) return;
  if (wishl <= watchl && watchr <= wishr) {
    AddEdge(u, Neg(k));
    return;
  }

  int mid = (watchl+watchr)/2;
  AddSegment(wishl, wishr,   k*2, watchl, mid, u);
  AddSegment(wishl, wishr, k*2+1, mid, watchr, u);
}

void SelectEdge(int d) {
  rep(i, 2) {
    es[i].clear();
    es[i].resize(size+K+size);
  }

  rreps(v, 2, size+K) {
    AddEdge(v, v/2);
  }

  for (pii &p : xs) {
    int x = p.X;
    int idx = ord[p.Y];
    int llim = lower_bound(all(xs), pii(x-d+1, -1)) - xs.begin();
    //cout << idx << ",llim: " << llim << endl;
    AddSegment(llim, idx, 1, 0, size, size+idx);
    int rlim = lower_bound(all(xs), pii(x+d, -1)) - xs.begin();
    //cout << idx << ",rlim: " << rlim << endl;
    AddSegment(idx+1, rlim, 1, 0, size, size+idx);
  }
}

bool check(int x) {
  SelectEdge(x);
  return DoScc();
}

int main() {
  cin >> N;
  rep(i, N) {
    rep(j, 2) {
      cin >> X[i][j];
      xs.eb(pii(X[i][j], i*2+j));
    }
  }
  sort(all(xs));
  K = 2*N;
  assert(xs.size() == K);
  rep(i, 2*N) {
    ord[xs[i].Y] = i;
  }
  size = 1;
  while (size < K) size <<= 1;

  int low = 0;
  int high = MOD;
  while (high - low > 1) {
    int mid = (low+high)/2;
    if (check(mid)) low = mid;
    else high = mid;
  }
  cout << low << endl;

  check(3);
}


Measured memory_bytes: 29184