//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
struct SegTree {
    typedef function<T(T, T)> OP;
    typedef function<void(T&, T)> UP;

    int N;
    vector<T> dat;
    OP op_;
    UP up_;
    T unit_;

    int get_n(int n) {
        int ret = 1;
        while (ret < n) ret <<= 1;

        return ret;
    }

    SegTree() : N(0) {}

    explicit SegTree(int n,
                     /// todo : ↓↓↓ edit from here ↓↓↓
                     OP op = [](T a, T b){ return min(a, b); },
                     UP up = [](T& a, T b){ a = min(a, b); },
                     T unit = INF)
                     : N(get_n(n)), dat(2 * N - 1, unit), op_(op), up_(up), unit_(unit) {}

    explicit SegTree(const vector<ll> &v,
                     /// todo : ↓↓↓ edit from here ↓↓↓
                     OP op = [](T a, T b){ return min(a, b); },
                     UP up = [](T& a, T b){ a = b; },
                     T unit = INF)
                     : N(get_n(v.size())), dat(2 * N - 1, unit), op_(op), up_(up), unit_(unit) {
        REP(i, v.size()) dat[N + i - 1] = v[i];
        for (int i = N - 2; i > -1; --i) dat[i] = _op(dat[2 * i + 1], dat[2 * i + 2]);
    }

    void init(int n, T val = 0) {
        N = get_n(n);
        dat.resize(2 * N - 1, val);
    }

    void update(int i, T v) {
        i += N - 1;
        up_(dat[i], v);

        while (i > 0) {
            i = (i - 1) / 2;
            dat[i] = op_(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }

    // query for [a, b), k: current node id, [l, r): current range.
    ll query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;

        if (b <= l || r <= a) return unit_;
        if (a <= l && r <= b) return dat[k];

        int mid = (l + r) / 2;
        T c1 = query(a, b, 2 * k + 1, l, mid);
        T c2 = query(a, b, 2 * k + 2, mid, r);

        return op_(c1, c2);
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int n;
    cin >> n;

    vector<pair<ll, ll>> v(n);
    REP(i, n) {
        ll a, b; cin >> a >> b;
        v[i] = {a, b};
    }

    sort(ALL(v));

    vector<int> compress;
    REP(i,  v.size()) compress.pb(v[i].se);
    sort(ALL(compress));
    compress.erase(unique(ALL(compress)), compress.end());
    map<int, int> m;
    REP(i, compress.size()) m[compress[i]] = i;

    ll ans = 0;

    SegTree<ll> st1(compress.size()), st2(compress.size());

    REP(i, n) {
        int x = v[i].fi, y = v[i].se;
        int yid = m[y];

        ans = max(ans, x - y - st1.query(yid, (int) compress.size() + 1));
        ans = max(ans, x + y - st2.query(0, yid));

        st1.update(yid, x - y);
        st2.update(yid, x + y);
    }

    print(ans);
    
}


Measured memory_bytes: 24808