// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e4 + 5, SIZE = 1e6 + 5;
const LL RNG = 1000000005;

int N;
Pii A[MAXN];

void input()
{
    read(N);
    for (int i = 0; i < N; ++i) {
        read(A[i].x); read(A[i].y);
    }
}

vector<int> G[SIZE];
int dfsclock, dfn[SIZE], low[SIZE];
int totscc, sccid[SIZE];
int top, st[SIZE];

void dfs(int u)
{
    dfn[u] = low[u] = ++dfsclock;
    st[++top] = u;
    for (int i = 0; i < SZ(G[u]); ++i) {
        int v = G[u][i];
        if (!dfn[v]) {
            dfs(v);
            chkmin(low[u], low[v]);
        } else if (!sccid[v])
            chkmin(low[u], dfn[v]);
    }
    if (low[u] == dfn[u]) {
        ++totscc;
        do {
            sccid[st[top]] = totscc;
        } while (st[top--] != u);
    }
}

namespace SEGT
{

int bias, size, root;
int lc[SIZE], rc[SIZE];

void insert(int &u, int f, LL l, LL r, LL p, int x)
{
    if (!u) {
        u = ++size;
        lc[u] = rc[u] = 0;
        G[bias + u].clear();
        if (f)
            G[bias + f].push_back(bias + u);
    }
    if (l == r) {
        G[bias + u].push_back(x);
        return;
    }
    LL mid = (l + r) / 2;
    if (p <= mid)
        insert(lc[u], u, l, mid, p, x);
    else
        insert(rc[u], u, mid + 1, r, p, x);
}

void link(int u, LL l, LL r, LL ql, LL qr, int x)
{
    if (!u)
        return;
    if (ql <= l && r <= qr) {
        G[x].push_back(bias + u);
        return;
    }
    LL mid = (l + r) >> 1;
    if (ql <= mid)
        link(lc[u], l, mid, ql, qr, x);
    if (mid < qr)
        link(rc[u], mid + 1, r, ql, qr, x);
}

}

inline void insert(LL p, int i, int u)
{
    SEGT::insert(SEGT::root, 0, 0, N * RNG + N, N * p + i, u);
}

inline void link(int d, LL p, int i, int u)
{
    LL l = N * (p - d), m = N * p + i, r = N * (p + d) + N - 1;
    if (l < m)
        SEGT::link(SEGT::root, 0, N * RNG + N, l, m - 1, u);
    if (m < r)
        SEGT::link(SEGT::root, 0, N * RNG + N, m + 1, r, u);
}

bool check(int d)
{
    SEGT::size = SEGT::root = 0;
    SEGT::bias = N * 2 - 1;

    for (int i = 0; i < N * 2; ++i) {
        G[i].clear();
    }
    for (int i = 0; i < N; ++i) {
        insert(A[i].x, i, i * 2 + 1);
        insert(A[i].y, i, i * 2);
    }
    for (int i = 0; i < N; ++i) {
        link(d, A[i].x, i, i * 2);
        link(d, A[i].y, i, i * 2 + 1);
    }

    int V = N * 2 + SEGT::size;
    dfsclock = totscc = 0;
    std::fill(dfn, dfn + V, 0);
    std::fill(sccid, sccid + V, 0);

    for (int i = 0; i < V; ++i) {
        if (!dfn[i])
            dfs(i);
    }
    for (int i = 0; i < N; ++i) {
        if (sccid[i * 2] == sccid[i * 2 + 1])
            return false;
    }
    return true;
}

void solve()
{
    int l = -1, r = RNG / (N - 1) + 5;
    while (l + 1 < r) {
        int mid = (l + r) >> 1;
        if (check(mid))
            l = mid;
        else
            r = mid;
    }

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

int main()
{
#ifdef __DEBUG
    freopen("F.in", "r", stdin);
    freopen("F.out", "w", stdout);
#endif

    input();
    solve();
}

// 不似秋光，只与离人照断肠。
//     -- 苏轼《减字木兰花·春月》


Measured memory_bytes: 86528