#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254 より

macro_rules! eprint {
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = write!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! eprintln {
    () => { eprintln!(""); };
    ($($t:tt)*) => {{
        use ::std::io::Write;
        let _ = writeln!(::std::io::stderr(), $($t)*);
    }};
}
macro_rules! dbg {
    ($v:expr) => {{
        let val = $v;
        eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
        val
    }}
}

macro_rules! mat {
    ($($e:expr),*) => { Vec::from(vec![$($e),*]) };
    ($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
    ($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
    ($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
    ($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
        $a$([$i])*.$f($($t),*)
    };
    ($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
        let t = $e;
        ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
    } };
}

pub fn readln() -> String {
    let mut line = String::new();
    ::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
    line
}

macro_rules! read {
    ($($t:tt),*; $n:expr) => {{
        let stdin = ::std::io::stdin();
        let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
            let line = line.unwrap();
            let mut it = line.split_whitespace();
            _read!(it; $($t),*)
        }).collect::<Vec<_>>();
        ret
    }};
    ($($t:tt),*) => {{
        let line = readln();
        let mut it = line.split_whitespace();
        _read!(it; $($t),*)
    }};
}

macro_rules! _read {
    ($it:ident; [char]) => {
        _read!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        Vec::from(_read!($it; String).into_bytes())
    };
    ($it:ident; usize1) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_read!($it; $t)),*)
    };
}


pub fn main() {
    let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

// const MOD: i64 = 998244353;
const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

// https://yukicoder.me/submissions/379658 より

pub trait TE {
    type T : Clone;
    type E : Clone;
    fn f(l: Self::T, r: Self::T) -> Self::T;
    fn g(l: Self::T, r: Self::E) -> Self::T;
    fn h(l: Self::E, r: Self::E) -> Self::E;
    fn ti() -> Self::T;
    fn ei() -> Self::E;
}

pub struct LazySegmentTree<R:TE> {
    size: usize,
    height: usize,
    a: Vec<(R::T, R::E)>,
}

impl <R: TE>  LazySegmentTree<R> {
    pub fn new(n: usize) -> LazySegmentTree<R>{
        let mut height = (n.next_power_of_two().trailing_zeros()+1) as usize;
        LazySegmentTree {
            size: 1<<height,
            height: height,
            a: vec![(R::ti(), R::ei());2<<height],
        }
    }

    pub fn build_by(v: &[R::T]) -> LazySegmentTree<R> {
        let n = v.len();
        let mut height = (n.next_power_of_two().trailing_zeros()+1) as usize;
        let mut a = vec![(R::ti(), R::ei());2<<height];
        for i in 0..n {
            a[(1<<height)+i].0 = v[i].clone();
        }
        for i in (1..(1<<height)).rev() {
            a[i].0 = R::f(a[2*i].0.clone(), a[2*i+1].0.clone());
        }
        LazySegmentTree {
            size: 1<<height,
            height: height,
            a: a,
        }
    }

    fn eval(&mut self, x: usize) -> R::T {
        R::g(self.a[x].0.clone(),self.a[x].1.clone())
    }

    fn propagate(&mut self, x: usize) {
        let b = x + self.size;
        for i in (1..=self.height).rev() {
            let k = b >> i;
            self.a[2*k].1 = R::h(self.a[2*k].1.clone(), self.a[k].1.clone());
            self.a[2*k+1].1 = R::h(self.a[2*k+1].1.clone(), self.a[k].1.clone());
            self.a[k].0 = self.eval(k);
            self.a[k].1 = R::ei();
        }
    }

    fn reflect(&mut self, x: usize) {
        let b = x + self.size;
        for i in (1..=self.height) {
            let k = b >> i;
            self.a[k].0 = R::f(self.eval(2*k).clone(),self.eval(2*k+1).clone());
        }
    }

    pub fn update(&mut self, l: usize, r: usize, e: R::E) {
        self.propagate(l);
        self.propagate(r-1);
        let mut x = l + self.size;
        let mut y = r + self.size;
        while x<y {
            if x&1==1 {
                self.a[x].1 = R::h(self.a[x].1.clone(), e.clone());
                x += 1;
            }
            if y&1==1 {
                y -= 1;
                self.a[x].1 = R::h(self.a[y].1.clone(), e.clone());
            }
            x >>= 1;
            y >>= 1;
        }
        self.reflect(l);
        self.reflect(r-1);
    }

    pub fn find(&mut self, l: usize, r: usize) -> R::T {
        self.propagate(l);
        self.propagate(r-1);
        let mut x = l + self.size;
        let mut y = r + self.size;
        let mut xv = R::ti();
        let mut yv = R::ti();
        while x<y {
            if x&1==1 {
                xv = R::f(xv.clone(), self.eval(x).clone());
                x += 1;
            }
            if y&1==1 {
                y -= 1;
                yv = R::f(self.eval(y).clone(), yv.clone());
            }
            x >>= 1;
            y >>= 1;
        }
        R::f(xv.clone(),yv.clone())
    }
}

struct R;
impl TE for R {
    type T = i64;
    type E = i64;
    fn f(l: Self::T, r: Self::T) -> Self::T {
        max(l,r)
    }
    fn g(p: Self::T, x: Self::E) -> Self::T {
        if x==INF {
            p
        }
        else {
            x
        }
    }
    fn h(f: Self::E, g: Self::E) -> Self::E {
        if g==INF {
            f
        }
        else {
            g
        }
    }
    fn ti() -> Self::T {
        -INF
    }
    fn ei() -> Self::E {
        INF
    }
}

fn solve() {
    let n = read!(usize);
    let mut xy = read!(i64,i64;n);
    xy.sort_by(|a,b| a.1.cmp(&b.1));
    let mut seg = LazySegmentTree::<R>::new(n);
    let mut seg2 = LazySegmentTree::<R>::new(n);
    let mut map = HashMap::new();
    for (i,&(x,y)) in xy.iter().enumerate() {
        map.insert((x,y),i);
        seg.update(i,i+1,x+y);
        seg2.update(i,i+1,x-y);
    }
    xy.sort();
    let mut ans = 0;
    for &(x,y) in &xy {
        let idx = *map.get(&(x,y)).unwrap();
        if idx > 0 {
            let ans1 = seg2.find(0,idx);
            ans = max(ans, ans1-x+y);
        }
        if idx < n {
            let ans2 = seg.find(idx+1,n);
            ans = max(ans, ans2-x-y);
        }
        seg.update(idx,idx+1,-INF);
        seg2.update(idx,idx+1,-INF);
    }
    println!("{}",ans);

}

fn run() {
    solve();
}


Measured memory_bytes: 48152