#include <bits/stdc++.h>

using std::cerr;
using std::endl;

inline int rd() {
  int a = 1, b = 0; char c = getchar();
  while (!isdigit(c)) a = c == '-' ? 0 : 1, c = getchar();
  while (isdigit(c)) b = b * 10 + c - '0', c = getchar();
  return a ? b : -b;
}

const int N = 5e4 + 2333;

int n, pos[N][2];

std::vector<int> G[N];

struct Point {
  int val, id;
} pt[N];

inline int operator<(const Point &a, const Point &b) {
  return a.val == b.val ? a.id < b.id : a.val < b.val;
}

int qwq[N][2];

int tot;

struct SegTree {
  int ls, rs;
} seg[N * 4];
int root;

void build(int &p, int l, int r) {
  if (l == r) {
    p = pt[l].id;
    return;
  }
  p = ++tot;
  int mid = (l + r) >> 1;
  build(seg[p].ls, l, mid);
  build(seg[p].rs, mid + 1, r);
  G[seg[p].ls].push_back(p);
  G[seg[p].rs].push_back(p);
  
  // cerr << p << " " << seg[p].ls << " " << seg[p].rs << endl;

}

void add(int p, int l, int r, int x, int L, int R) {
  if (l <= L && r >= R) {
    G[p].push_back(x);
    // cerr << p << " -> " << x << endl;
    return;
  }
  int mid = (L + R) >> 1;
  if (l <= mid)
    add(seg[p].ls, l, r, x, L, mid);
  if (r > mid)
    add(seg[p].rs, l, r, x, mid + 1, R);

  /*
  for (int i = l; i <= r; ++i) {
    G[pt[i].id].push_back(x);
    cerr << pt[i].id << " " << x << endl;
  }
  */

}

int dfn[N], low[N], num, ins[N], stk[N], top, bel[N], cnt;

void tarjan(int x) {
  dfn[x] = low[x] = ++num;
  ins[stk[++top] = x] = 1;
  for (int y : G[x]) {
    if (!dfn[y]) {
      tarjan(y);
      low[x] = std::min(low[x], low[y]);
    } else if (ins[y])
      low[x] = std::min(low[x], dfn[y]);
  }
  if (low[x] == dfn[x]) {
    int y; ++cnt;
    do {
      ins[y = stk[top--]] = 0;
      bel[y] = cnt;
    } while (x != y);
  }
}

inline int check(int dis) {
  for (int i = 1; i <= tot; ++i) {
    G[i].clear();
    dfn[i] = low[i] = 0;
    bel[i] = ins[i] = 0;
  }
  cnt = 0;
  tot = n * 2;

  build(root, 1, n * 2);

  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 2; ++j) {
      int l = std::lower_bound(pt + 1, pt + n * 2 + 1, Point { pos[i][j] - dis + 1, 0 }) - pt,
        r = std::upper_bound(pt + 1, pt + n * 2 + 1, Point { pos[i][j] + dis - 1, n * 2 + 1,  }) - pt - 1,
        m = std::lower_bound(pt + 1, pt + n * 2 + 1, Point { pos[i][j], j * n + i }) - pt;

      // cerr << i << " " << j << endl;
      // cerr << l << " " << r << " " << m << endl;

      /*
      if (i == 1 && j == 0) {
        cerr << pos[i][j] - dis + 1 << endl;
        cerr << l  << " " << r << " " << m << endl << endl;
      }
      */


      if (l < m)
        add(root, l, m - 1, !j * n + i, 1, n * 2);
      if (r > m)
        add(root, m + 1, r, !j * n + i, 1, n * 2);
    }
  }

  for (int i = 1; i <= tot; ++i)
    if (!dfn[i])
      tarjan(i);
  
  /*
  for (int i = 1; i <= tot; ++i)
    cerr << bel[i] << " ";
  cerr << endl;
  */

  for (int i = 1; i <= n; ++i)
    if (bel[i] == bel[n + i])
      return 0;

  return 1;
}

int main() {
//   freopen("data", "r", stdin);
//   freopen("1.out", "w", stdout);

  n = rd();

  int min = 1e9, max = -1e9;

  for (int i = 1; i <= n; ++i) {
    pos[i][0] = rd(), pos[i][1] = rd();
    pt[++tot] = { pos[i][0], i };
    pt[++tot] = { pos[i][1], n + i };

    min = std::min(min, std::min(pos[i][0], pos[i][1]));
    max = std::max(max, std::max(pos[i][0], pos[i][1]));
  }

  std::sort(pt + 1, pt + n * 2 + 1);

  int ans = 0;

  // cerr << min << " " << max << endl;

  int l = 1, r = max - min;
  
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }

  // cerr << check(4) << endl;

  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 13184