#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cassert>

#define X first
#define Y second

#define MK std::make_pair

typedef std::pair<int, int> pii;

template <typename T> inline bool chkmax(T &x, T y) {
  return x<y? x=y, true : false;
}

template <typename T> inline bool chkmin(T &x, T y) {
  return y<x? x=y, true : false;
}

enum {
  MAXN = 100000 + 5,
  MAXM = 2000000 + 5
};

#define MID ((l+r)>>1)

struct edge {
  int u, v, next;
  edge() {
  }

  edge(int _u, int _v, int _next):
    u(_u), v(_v), next(_next) {}
};

int tote, totn;
int head[MAXN];
edge E[MAXM];

namespace SCC {
  int totscc;
  int sccid[MAXN];
  int dfn[MAXN];
  int low[MAXN];

  int top;
  int st[MAXN];

  int dfc;

  void dfs(int u) {
    int e, v;
    dfn[u] = low[u] = dfc++;
    st[top++] = u;
    for (e=head[u]; ~e; e=E[e].next) {
      v = E[e].v;
      if (!~dfn[v]) {
	dfs(v);
	chkmin(low[u], low[v]);
      } else if (!~sccid[v])
	chkmin(low[u], dfn[v]);
    }
    if (low[u] == dfn[u]) {
      while (true) {
	sccid[st[top-1]] = totscc;
	--top;
	if (st[top] == u)
	  break;
      }
      ++ totscc;
    }
  }

  void exec() {
    int i;
    totscc = dfc = 0;
    memset(sccid, -1, sizeof sccid);
    memset(dfn, -1, sizeof dfn);
    for (i=0; i<MAXN; ++i)
      if (!~dfn[i])
	dfs(i);
  }
}

int n;
int tot;
pii a[MAXN], in[MAXN];
int c[MAXN];
int id[MAXN][2];

int ontree[MAXN];

void addedge(int u, int v) {
  E[tote] = edge(u, v, head[u]), head[u] = tote++;
}

void build(int o, int l, int r) {
  chkmax(totn, o+1);
  if (o > 1)
    addedge(o>>1, o);
  if (r-l > 1) {
    build(o<<1,   l, MID);
    build(o<<1|1, MID, r);
  } else
    ontree[l] = o;
}

void addedge(int o, int l, int r, int ql, int qr, int u) {
  if (l >= r) return ;
  if (ql >= qr) return ;
  
  if (ql <= l && r <= qr)
    addedge(u, o);
  else {
    if (ql < MID) addedge(o<<1,   l, MID, ql, qr, u);
    if (MID < qr) addedge(o<<1|1, MID, r, ql, qr, u);
  }
}

bool check(int d) {
  int u, l, r;
  
  tote = totn = 0;
  memset(head, -1, sizeof head);
  build(1, 0, tot);

  for (u=0; u<n; ++u) {
    addedge(ontree[id[u][0]], totn + id[u][1]);
    addedge(ontree[id[u][1]], totn + id[u][0]);
    addedge(totn + id[u][1], ontree[id[u][0]]);
    addedge(totn + id[u][0], ontree[id[u][1]]);
    
    l = std::upper_bound(c, c+tot, in[u].X - d) - c;
    r = std::upper_bound(c, c+tot, in[u].X+d-1) - c;
    addedge(1, 0, tot, l,   id[u][0], totn + id[u][0]);
    addedge(1, 0, tot, id[u][0]+1, r, totn + id[u][0]);

    l = std::upper_bound(c, c+tot, in[u].Y - d) - c;
    r = std::upper_bound(c, c+tot, in[u].Y+d-1) - c;
    addedge(1, 0, tot, l,   id[u][1], totn + id[u][1]);
    addedge(1, 0, tot, id[u][1]+1, r, totn + id[u][1]);    
  }

  assert(tote < MAXM);
  
  SCC::exec();

  for (u=0; u<n; ++u)
    if (SCC::sccid[totn + id[u][0]] == SCC::sccid[totn + id[u][1]])
      return false;

  return true;
}

void exec() {
  pii info;
  int i, x, y, l, r;

  scanf("%d", &n);

  tot = 0;
  for (i=0; i<n; ++i) {
    scanf("%d%d", &x, &y);
    a[tot++] = std::make_pair(x, i<<1);
    a[tot++] = std::make_pair(y, i<<1|1);
    in[i] = std::make_pair(x, y);
  }

  std::sort(a, a+tot);
  for (i=0; i<tot; ++i) c[i] = a[i].X;
  for (i=0; i<n; ++i) {
    id[i][0] = std::lower_bound(a, a+tot, MK(in[i].X, i<<1)) - a;
    id[i][1] = std::lower_bound(a, a+tot, MK(in[i].Y, i<<1|1)) - a;
  }

  l = 0, r = 1e9 + 1;

  while (l+1 < r)
    (check(MID)? l : r) = MID;

  printf("%d\n", l);
}

int main() {
  if (fopen("F.in", "r") != NULL) {
    freopen("F.in", "r", stdin);
    freopen("F.out", "w", stdout);
  }
  exec();
  return 0;
}


Measured memory_bytes: 17408