// ---------- begin Strongly Connected Components ----------
struct SCCforSAT2 {
    graph: Vec<Vec<usize>>,
    inv_graph: Vec<Vec<usize>>,
    id: Vec<usize>,
}

impl SCCforSAT2 {
    pub fn new(size: usize) -> Self {
        SCCforSAT2 {
            graph: vec![vec![]; size],
            inv_graph: vec![vec![]; size],
            id: Vec::with_capacity(size),
        }
    }
    pub fn add_edge(&mut self, from: usize, to: usize) {
        self.graph[from].push(to);
        self.inv_graph[to].push(from);
    }
    pub fn build(&mut self) {
        let size = self.graph.len();
        let mut visited = vec![false; size];
        let mut q = vec![];
        let mut stack = vec![];
        for v in 0..size {
            if visited[v] {
                continue;
            }
            stack.clear();
            stack.push((v, 0));
            while let Some((v, s)) = stack.pop() {
                visited[v] = true;
                let mut finish = true;
                for (i, &u) in self.graph[v][s..].iter().enumerate() {
                    if !visited[u] {
                        finish = false;
                        stack.push((v, s + i + 1));
                        stack.push((u, 0));
                        break;
                    }
                }
                if finish {
                    q.push(v);
                }
            }
        }
        self.id.clear();
        self.id.resize(size, size);
        let mut counter = 0;
        let mut stack = vec![];
        for &v in q.iter().rev() {
            if self.id[v] < size {
                continue;
            }
            self.id[v] = counter;
            stack.clear();
            stack.push(v);
            while let Some(v) = stack.pop() {
                self.id[v] = counter;
                for &u in self.inv_graph[v].iter() {
                    if self.id[u] == size {
                        self.id[u] = counter;
                        stack.push(u);
                    }
                }
            }
            counter += 1;
        }
    }
    pub fn get_array(&self) -> Vec<usize> {
        self.id.clone()
    }
}
// ---------- end Strongly Connected Components ----------
// ---------- begin 2-SAT ----------
struct SAT2 {
    size: usize,
    scc: SCCforSAT2,
}

impl SAT2 {
    fn new(size: usize) -> Self {
        SAT2 {
            size: size,
            scc: SCCforSAT2::new(2 * size),
        }
    }
    fn add(&mut self, a: usize, b: usize) {
        let size = self.size;
        let (x, ix) = if a >= size {
            (!a + size, !a)
        } else {
            (a, a + size)
        };
        let (y, iy) = if b >= size {
            (!b + size, !b)
        } else {
            (b, b + size)
        };
        self.scc.add_edge(ix, y);
        self.scc.add_edge(iy, x);
    }
    fn solve(&mut self) -> Option<Vec<bool>> {
        self.scc.build();
        let id = self.scc.get_array();
        let mut ans = vec![];
        for i in 0..self.size {
            if id[i] == id[i + self.size] {
                return None;
            } else if id[i] < id[i + self.size] {
                ans.push(false);
            } else {
                ans.push(true);
            }
        }
        Some(ans)
    }
}
// ---------- end 2-SAT ----------

use std::io::Read;

fn can(m: i32, p: &[(i32, i32)]) -> bool {
    let mut z = vec![];
    for (i, &(x, y)) in p.iter().enumerate() {
        z.push((x, i + 1));
        z.push((y, i + 1));
    }
    z.sort();
    z.dedup();
    let size = z.len().next_power_of_two();
    let seg: Vec<usize> = (0..(2 * size)).collect();
    let ng_seg: Vec<usize> = seg.iter().map(|p| !*p).collect();
    let mut index = vec![];
    for i in 0..p.len() {
        index.push((2 * size + i, 2 * size + p.len() + i));
    }
    let mut sat = SAT2::new(2 * size + 2 * p.len());
    for i in 1..size {
        sat.add(seg[i], ng_seg[2 * i]);
        sat.add(seg[i], ng_seg[2 * i + 1]);
    }
    for (i, &(x, y)) in p.iter().enumerate() {
        sat.add(index[i].0, index[i].1);
        let a = z.binary_search(&(x, i + 1)).unwrap();
        let b = z.binary_search(&(y, i + 1)).unwrap();
        sat.add(!index[i].0, seg[a + size]);
        sat.add(!index[i].1, seg[b + size]);
        for &(x, a, q) in [(x, a, index[i].0), (y, b, index[i].1)].iter() {
            let l = z.binary_search(&(x - (m - 1), 0)).unwrap_err();
            let r = z.binary_search(&(x + (m - 1), p.len() + 1)).unwrap_err();
            for &(mut l, mut r) in [(l, a), (a + 1, r)].iter() {
                l += size;
                r += size;
                while l < r {
                    if l & 1 == 1 {
                        sat.add(!q, ng_seg[l]);
                        l += 1;
                    }
                    if r & 1 == 1 {
                        r -= 1;
                        sat.add(!q, ng_seg[r]);
                    }
                    l >>= 1;
                    r >>= 1;
                }
            }
        }
    }
    sat.solve().is_some()
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut p = vec![];
    for _ in 0..n {
        let x: i32 = it.next().unwrap().parse().unwrap();
        let y: i32 = it.next().unwrap().parse().unwrap();
        p.push((x, y));
    }
    let mut ok = 0;
    let mut ng = 1_000_000_000i32;
    while ng - ok > 1 {
        let m = (ok + ng) / 2;
        if can(m, &p) {
            ok = m;
        } else {
            ng = m;
        }
    }
    println!("{}", ok);
}

fn main() {
    run();
}


Measured memory_bytes: 65564