/**
 *    author:  tourist
 *    created: 20.01.2020 16:00:17       
**/
#undef _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template <typename T>
class graph {
 public:
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual void add(int from, int to) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  void add(int from, int to) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    g[from].push_back(to);
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (int i = 0; i < n; i++) {
      for (int j : g[i]) {
        rev.add(j, i);
      }
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int to : g.g[v]) {
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int to : g_rev.g[v]) {
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

class twosat {
 public:
  digraph<int> g;
  int n;

  twosat(int _n) : g(digraph<int>(2 * _n)), n(_n) {
  }

  // (v[x] == value_x)
  inline void add(int x, int value_x) {
    assert(0 <= x && x < n);
    assert(0 <= value_x && value_x <= 1);
    g.add(2 * x + (value_x ^ 1), 2 * x + value_x);
  }
  
  // (v[x] == value_x || v[y] == value_y)
  inline void add(int x, int value_x, int y, int value_y) {
    assert(0 <= x && x < n && 0 <= y && y < n);
    assert(0 <= value_x && value_x <= 1 && 0 <= value_y && value_y <= 1);
    g.add(2 * x + (value_x ^ 1), 2 * y + value_y);
    g.add(2 * y + (value_y ^ 1), 2 * x + value_x);
  }

  inline vector<int> solve() {
    int cnt;
    vector<int> c = find_scc(g, cnt);
    vector<int> res(n);
    for (int i = 0; i < n; i++) {
      if (c[2 * i] == c[2 * i + 1]) {
        return vector<int>();
      }
      res[i] = (c[2 * i] < c[2 * i + 1]);
    }
    return res;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> xx(2 * n);
  for (int i = 0; i < n; i++) {
    cin >> xx[2 * i].first >> xx[2 * i + 1].first;
    xx[2 * i].second = i;
    xx[2 * i + 1].second = i;
  }
  sort(xx.begin(), xx.end());
  vector<vector<int>> pos(n);
  for (int i = 0; i < 2 * n; i++) {
    pos[xx[i].second].push_back(i);
  }
  vector<int> single(2 * n, -1);
  function<void(int, int, int)> FindSingle = [&](int x, int l, int r) {
    if (l == r) {
      single[l] = x;
      return;
    }
    int y = (l + r) >> 1;
    int z = x + 2 * (y - l + 1);
    FindSingle(x + 1, l, y);
    FindSingle(z, y + 1, r);
  };
  FindSingle(0, 0, 2 * n - 1);
  twosat ts(4 * n - 1);
  int low = 0, high = (int) 1e9;
  while (low < high) {
    int mid = (low + high + 1) >> 1;
    for (int i = 0; i < 2 * (4 * n - 1); i++) {
      ts.g.g[i].clear();
    }
    int R = 0;
    vector<bool> marked(4 * n - 1, false);
    for (int L = 0; L < 2 * n; L++) {
      while (R + 1 < 2 * n && xx[R + 1].first - xx[L].first < mid) {
        ++R;
      }
      vector<int> vers;
      function<void(int, int, int)> Mark = [&](int x, int l, int r) {
        if (marked[x] || l == r) {
          return;
        }
        marked[x] = true;
        int y = (l + r) >> 1;
        int z = x + 2 * (y - l + 1);
        ts.add(x + 1, 0, z, 0);
        ts.add(x + 1, 0, x, 1);
        ts.add(z, 0, x, 1);
        Mark(x + 1, l, y);
        Mark(z, y + 1, r);
      };
      function<void(int, int, int, int, int)> Go = [&](int x, int l, int r, int ll, int rr) {
        if (ll <= l && r <= rr) {
          vers.push_back(x);
          Mark(x, l, r);
          return;
        }
        int y = (l + r) >> 1;
        int z = x + 2 * (y - l + 1);
        if (ll <= y) {
          Go(x + 1, l, y, ll, rr);
        }
        if (rr > y) {
          Go(z, y + 1, r, ll, rr);
        }
      };
      Go(0, 0, 2 * n - 1, L, R);
      int sz = (int) vers.size();
/*      int off = ts.n;
      ts.n += sz - 1;
      ts.g.n += 2 * (sz - 1);
      ts.g.g.resize(ts.g.n);
      for (int i = 0; i < sz - 1; i++) {
        ts.add(off + i, 1, vers[i], 0);
        if (i > 0) {
          ts.add(off + i, 1, off + (i - 1), 0);
        }
        ts.add(off + i, 0, vers[i + 1], 0);
      }*/
      for (int i = 0; i < sz; i++) {
        for (int j = i + 1; j < sz; j++) {
          ts.add(vers[i], 0, vers[j], 0);
        }
      }
    }
    for (int i = 0; i < n; i++) {
      ts.add(single[pos[i][0]], 0, single[pos[i][1]], 0);
      ts.add(single[pos[i][0]], 1, single[pos[i][1]], 1);
    }
    if (!ts.solve().empty()) {
      low = mid;
    } else {
      high = mid - 1;
    }
  }
  cout << low << '\n';
  return 0;
}


Measured memory_bytes: 78380