Problem:
Score : 500 points

Problem Statement

There are N points on the 2D plane, i-th of which is located on (x_i, y_i).
There can be multiple points that share the same coordinate.
What is the maximum possible Manhattan distance between two distinct points?

Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq x_i,y_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
x_2 y_2
:
x_N y_N

Output

Print the answer.

Sample Input 1

3
1 1
2 4
3 2

Sample Output 1

4

The Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.

Sample Input 2

2
1 1
1 1

Sample Output 2

0

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

/**
 *  author: chaitanya
 *  created: 05:43:06 PM, 13 September 2020
 **/
#include <bits/stdc++.h>
using namespace std;

#define intll 1
#define interactive 0

#ifdef chaitanya
#include "/home/chaitanya/.templates/header.h"
#else
#define debug(x...)
#endif

#if !interactive
#define IOS                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);                      \
  cin.exceptions(cin.failbit);
#define endl "\n"
#else
#define IOS
#endif

#if intll
#define int long long int
#endif

#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define F first
#define S second

const int N = 300009;
const int mod = 1000000007;

void pre() {}

int32_t main() {
  IOS;
  pre();
  int n;
  cin >> n;
  vector<pii> v(n);
  rep(i, 0, n) cin >> v[i].first >> v[i].second;
  vvi dp(4, vi(n, 0));
  rep(i, 0, n) {
    dp[0][i] = v[i].first + v[i].second;
    dp[1][i] = v[i].first - v[i].second;
    dp[2][i] = -v[i].first + v[i].second;
    dp[3][i] = -v[i].first - v[i].second;
  }

  int ans = 0;

  int mx[4];
  rep(i, 0, 4) { mx[i] = *max_element(all(dp[i])); }

  ans = max(ans, mx[0] + mx[3]);
  ans = max(ans, mx[1] + mx[2]);

  cout << ans << endl;

  return 0;
}