There are n detachments on the surface, numbered from 1 to n, the i-th detachment is placed in a point with coordinates (x_i, y_i). All detachments are placed in different points.

Brimstone should visit each detachment at least once. You can choose the detachment where Brimstone starts.

To move from one detachment to another he should first choose one of four directions of movement (up, right, left or down) and then start moving with the constant speed of one unit interval in a second until he comes to a detachment. After he reaches an arbitrary detachment, he can repeat the same process.

Each t seconds an orbital strike covers the whole surface, so at that moment Brimstone should be in a point where some detachment is located. He can stay with any detachment as long as needed.

Brimstone is a good commander, that's why he can create at most one detachment and place it in any empty point with integer coordinates he wants before his trip. Keep in mind that Brimstone will need to visit this detachment, too.

Help Brimstone and find such minimal t that it is possible to check each detachment. If there is no such t report about it.

Input

The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of detachments.

In each of the next n lines there is a pair of integers x_i, y_i (|x_i|, |y_i| ≤ 10^9) — the coordinates of i-th detachment.

It is guaranteed that all points are different.

Output

Output such minimal integer t that it is possible to check all the detachments adding at most one new detachment.

If there is no such t, print -1.

Examples

Input


4
100 0
0 100
-100 0
0 -100


Output


100

Input


7
0 2
1 0
-3 0
0 -2
-1 -1
-1 -3
-2 -3


Output


-1

Input


5
0 0
0 -1
3 0
-2 0
-2 1


Output


2

Input


5
0 0
2 0
0 -1
-2 0
-2 1


Output


2

Note

In the first test it is possible to place a detachment in (0, 0), so that it is possible to check all the detachments for t = 100. It can be proven that it is impossible to check all detachments for t < 100; thus the answer is 100.

In the second test, there is no such t that it is possible to check all detachments, even with adding at most one new detachment, so the answer is -1.

In the third test, it is possible to place a detachment in (1, 0), so that Brimstone can check all the detachments for t = 2. It can be proven that it is the minimal such t.

In the fourth test, there is no need to add any detachments, because the answer will not get better (t = 2). It can be proven that it is the minimal such t.
#include <bits/stdc++.h>
std::mt19937_64 rng(
    std::chrono::steady_clock::now().time_since_epoch().count());
long long int myRand(long long int R) {
  long long int val = rng() % R;
  assert(val >= 0);
  return val;
}
const long double PI = atan(1.0) * 4;
const int64_t INF64 = 3e18;
const int32_t INF32 = 2e9 + 7;
const int32_t LOG = 21;
const int32_t MOD = 1e9 + 7;
using namespace std;
void my_debugger(string second, long long int LINE_NUM) { cerr << '\n'; }
template <typename start, typename... end>
void my_debugger(string second, long long int LINE_NUM, start x, end... y) {
  if (second.back() != ',') {
    second += ',';
    cerr << "LINE(" << LINE_NUM << "): ";
  }
  long long int i = second.find(',');
  cerr << second.substr(0, i) << " = " << x;
  second = second.substr(i + 1);
  if (!second.empty()) cerr << ", ";
  my_debugger(second, LINE_NUM, y...);
}
long long int label[1005];
bool check[1005];
vector<long long int> v[1005];
void dfs(long long int i, long long int num) {
  label[i] = num;
  check[i] = true;
  for (auto it : v[i]) {
    if (check[it]) continue;
    dfs(it, num);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  long long int tests = 1;
  for (long long int ii = 0; ii < (long long int)tests; ii++) {
    long long int n;
    cin >> n;
    vector<pair<long long int, long long int>> coor(n);
    map<long long int, vector<pair<long long int, long long int>>> x, y;
    for (long long int i = 0; i < (long long int)n; i++)
      cin >> coor[i].first >> coor[i].second;
    for (long long int i = 0; i < (long long int)n; i++) {
      x[coor[i].first].push_back({coor[i].second, i});
      y[coor[i].second].push_back({coor[i].first, i});
    }
    for (auto& it : x) sort(it.second.begin(), it.second.end());
    for (auto& it : y) sort(it.second.begin(), it.second.end());
    long long int l = 1, r = 2e9;
    long long int ans = INF32;
    while (l <= r) {
      long long int mid = (l + r) >> 1;
      for (long long int i = 0; i < (long long int)n; i++) {
        v[i].clear();
        check[i] = false;
      }
      for (auto& it : x) {
        vector<pair<long long int, long long int>>& vec = it.second;
        for (long long int i = 1; i < (long long int)vec.size(); i++) {
          long long int j = vec[i].second, k = vec[i - 1].second;
          if (vec[i].first - vec[i - 1].first <= mid) {
            v[j].push_back(k);
            v[k].push_back(j);
          }
        }
      }
      for (auto& it : y) {
        vector<pair<long long int, long long int>>& vec = it.second;
        for (long long int i = 1; i < (long long int)vec.size(); i++) {
          long long int j = vec[i].second, k = vec[i - 1].second;
          if (vec[i].first - vec[i - 1].first <= mid) {
            v[j].push_back(k);
            v[k].push_back(j);
          }
        }
      }
      long long int comps = 0;
      for (long long int i = 0; i < (long long int)n; i++) {
        if (check[i]) continue;
        dfs(i, comps++);
      }
      if (comps > 4) {
        l = mid + 1;
        continue;
      }
      bool g = false;
      if (comps == 1) {
        ans = min(ans, mid);
        r = mid - 1;
        continue;
      } else if (comps == 2) {
        for (long long int i = 0; i < (long long int)n; i++) {
          if (g) break;
          for (long long int j = i + 1; j < (long long int)n; j++) {
            if (g) break;
            if (label[i] == label[j]) continue;
            if (coor[i].first == coor[j].first &&
                abs(coor[i].second - coor[j].second) <= 2 * mid)
              g = true;
            if (coor[i].second == coor[j].second &&
                abs(coor[i].first - coor[j].first) <= 2 * mid)
              g = true;
            if (abs(coor[i].first - coor[j].first) <= mid &&
                abs(coor[i].second - coor[j].second) <= mid)
              g = true;
          }
        }
      } else if (comps == 3) {
        vector<pair<long long int, long long int>> seg;
        for (auto& it : x) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            seg.push_back({j, k});
          }
        }
        for (auto& it : y) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            seg.push_back({j, k});
          }
        }
        for (auto& it : seg) {
          long long int j = it.first, k = it.second;
          for (long long int i = 0; i < (long long int)n; i++) {
            if (g) break;
            if (label[i] == label[j] || label[i] == label[k]) continue;
            if (coor[j].first == coor[k].first) {
              long long int x1 = coor[j].first;
              long long int y1 = coor[i].second;
              bool ok = true;
              for (auto it : {coor[i], coor[j], coor[k]}) {
                if (abs(x1 - it.first) > mid || abs(y1 - it.second) > mid)
                  ok = false;
              }
              if (ok) g = true;
            } else {
              long long int x1 = coor[i].first;
              long long int y1 = coor[j].second;
              bool ok = true;
              for (auto it : {coor[i], coor[j], coor[k]}) {
                if (abs(x1 - it.first) > mid || abs(y1 - it.second) > mid)
                  ok = false;
              }
              if (ok) g = true;
            }
          }
        }
      } else {
        vector<pair<long long int, long long int>> segx, segy;
        for (auto& it : x) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            segx.push_back({j, k});
          }
        }
        for (auto& it : y) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            segy.push_back({j, k});
          }
        }
        for (long long int i = 0; i < (long long int)segx.size(); i++) {
          if (g) break;
          for (long long int j = 0; j < (long long int)segy.size(); j++) {
            if (label[segx[i].first] == label[segy[j].first] ||
                label[segx[i].first] == label[segy[j].second])
              continue;
            if (label[segx[i].second] == label[segy[j].first] ||
                label[segx[i].second] == label[segy[j].second])
              continue;
            if (g) break;
            long long int same_x = coor[segx[i].first].first;
            long long int same_y = coor[segy[j].first].second;
            bool ok = true;
            for (auto it : {coor[segx[i].first], coor[segx[i].second],
                            coor[segy[j].first], coor[segy[j].second]}) {
              if (abs(same_x - it.first) > mid || abs(same_y - it.second) > mid)
                ok = false;
            }
            if (ok) g = true;
          }
        }
      }
      if (g) {
        ans = min(ans, mid);
        r = mid - 1;
      } else
        l = mid + 1;
    }
    if (ans == INF32) ans = -1;
    cout << ans << '\n';
  }
  return 0;
}
