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>
using namespace std;
template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
  bool done_something = false;
  stringstream res;
  res << "[";
  for (; begin_iter != end_iter and counter; ++begin_iter) {
    done_something = true;
    counter--;
    res << *begin_iter << ", ";
  }
  string str = res.str();
  if (done_something) {
    str.pop_back();
    str.pop_back();
  }
  str += "]";
  return str;
}
vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
  vector<int> ord(size);
  for (int i = 0; i < size; i++) ord[i] = i;
  sort(ord.begin(), ord.end(), compare);
  return ord;
}
template <typename T>
bool MinPlace(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool MaxPlace(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T>& p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  for (int i = 0; i < (int)v.size(); i++) {
    out << v[i];
    if (i != (int)v.size() - 1) out << ", ";
  }
  out << "]";
  return out;
}
template <class TH>
void _dbg(const char* name, TH val) {
  clog << name << ": " << val << endl;
}
template <class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
  while (*names != ',') clog << *names++;
  clog << ": " << curr_val << ", ";
  _dbg(names + 1, vals...);
}
const int MAXN = 1100;
int N;
map<int, map<int, int>> horiz, vert;
long long xxx[MAXN], yyy[MAXN];
long long T;
int cc = 0;
int comp[MAXN];
bool visited[MAXN];
vector<pair<int, long long>> aa(long long x, long long y) {
  vector<pair<int, long long>> vec;
  auto it1 = horiz[y].upper_bound(x);
  auto it2 = horiz[y].lower_bound(x);
  if (it1 != horiz[y].end()) {
    long long new_x = it1->first;
    vec.push_back({it1->second, llabs(new_x - x)});
  }
  if (it2 != horiz[y].begin()) {
    it2 = prev(it2);
    long long new_x = it2->first;
    vec.push_back({it2->second, llabs(x - new_x)});
  }
  auto it3 = vert[x].upper_bound(y);
  auto it4 = vert[x].lower_bound(y);
  if (it3 != vert[x].end()) {
    long long new_y = it3->first;
    vec.push_back({it3->second, llabs(y - new_y)});
  }
  if (it4 != vert[x].begin()) {
    it4 = prev(it4);
    long long new_y = it4->first;
    vec.push_back({it4->second, llabs(y - new_y)});
  }
  return vec;
}
void dfs(int v) {
  comp[v] = cc;
  visited[v] = true;
  const auto& vec = aa(xxx[v], yyy[v]);
  for (const auto& pp : vec) {
    if (pp.second > T) continue;
    int a = pp.first;
    if (!visited[a]) dfs(a);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  set<int> xx, yy;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    xxx[i] = x, yyy[i] = y;
    horiz[y][x] = i;
    vert[x][y] = i;
    xx.insert(x), yy.insert(y);
  }
  vector<vector<pair<int, long long>>> possible;
  for (int x : xx)
    for (int y : yy) {
      if (horiz[y].count(x)) continue;
      possible.push_back(aa(x, y));
    }
  for (int x : xx) {
    const auto& v = vert[x];
    for (auto it = v.begin(); next(it) != v.end(); it++) {
      long long y1 = it->first;
      long long y2 = next(it)->first;
      int id1 = it->second;
      int id2 = next(it)->second;
      vector<pair<int, long long>> vec;
      long long dist = llabs(y1 - y2);
      if (dist == 1) continue;
      vec.push_back({id1, dist / 2});
      vec.push_back({id2, dist - dist / 2});
      possible.push_back(vec);
    }
  }
  for (int y : yy) {
    const auto& v = horiz[y];
    for (auto it = v.begin(); next(it) != v.end(); it++) {
      long long y1 = it->first;
      long long y2 = next(it)->first;
      int id1 = it->second;
      int id2 = next(it)->second;
      vector<pair<int, long long>> vec;
      long long dist = llabs(y1 - y2);
      if (dist == 1) continue;
      vec.push_back({id1, dist / 2});
      vec.push_back({id2, dist - dist / 2});
      possible.push_back(vec);
    }
  }
  long long l = 1;
  long long r = 1e12;
  bool check_me[4];
  while (l < r) {
    long long m = (l + r) / 2;
    T = m;
    cc = 0;
    for (int i = 0; i < N; i++) visited[i] = false;
    for (int i = 0; i < N; i++) {
      if (visited[i]) continue;
      dfs(i);
      cc++;
    }
    if (cc > 4) {
      l = m + 1;
      continue;
    }
    if (cc == 1) {
      r = m;
      continue;
    }
    bool connected = false;
    for (auto& vec : possible) {
      if (((int)((vec).size())) < cc) continue;
      for (int i = 0; i < cc; i++) check_me[i] = false;
      for (auto pp : vec) {
        if (pp.second <= T) check_me[comp[pp.first]] = true;
      }
      bool ok = true;
      for (int i = 0; i < cc; i++) ok &= check_me[i];
      if (ok) {
        connected = true;
        break;
      }
    }
    if (connected)
      r = m;
    else
      l = m + 1;
  }
  if (l > 1e10)
    cout << -1 << "\n";
  else
    cout << l;
}
