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>
#pragma GCC optimize(3)
#pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
using namespace std;
map<int, vector<pair<int, int>>> X, Y;
struct Vertex {
  int x, y, id;
};
struct Edge {
  Vertex u, v;
  bool ishorizontal() { return u.y == v.y; }
  bool isvertical() { return u.x == v.x; }
  int length() {
    if (ishorizontal()) return abs(u.x - v.x);
    return abs(u.y - v.y);
  }
};
Vertex vc[1011];
vector<Edge> edg;
int N, f[1011];
void init() {
  int i;
  for (i = 1; i <= N; ++i) f[i] = i;
}
int find(int v) {
  if (f[v] == v) return v;
  return f[v] = find(f[v]);
}
void unionset(int v1, int v2) {
  int a = find(v1), b = find(v2);
  f[a] = b;
}
void preprocess() {
  int i;
  auto iter = X.begin();
  while (iter != X.end()) {
    sort(iter->second.begin(), iter->second.end());
    int sz = iter->second.size();
    for (i = 0; i < sz - 1; ++i) {
      Vertex v1 =
          Vertex{iter->first, iter->second[i].first, iter->second[i].second};
      Vertex v2 = Vertex{iter->first, iter->second[i + 1].first,
                         iter->second[i + 1].second};
      Edge e = Edge{v1, v2};
      edg.push_back(e);
    }
    ++iter;
  }
  iter = Y.begin();
  while (iter != Y.end()) {
    sort(iter->second.begin(), iter->second.end());
    int sz = iter->second.size();
    for (i = 0; i < sz - 1; ++i) {
      Vertex v1 =
          Vertex{iter->second[i].first, iter->first, iter->second[i].second};
      Vertex v2 = Vertex{iter->second[i + 1].first, iter->first,
                         iter->second[i + 1].second};
      Edge e = Edge{v1, v2};
      edg.push_back(e);
    }
    ++iter;
  }
}
bool valid(int T) {
  init();
  int tol = N, i, j;
  for (auto e : edg) {
    if (e.length() <= T) {
      if (find(e.u.id) != find(e.v.id)) {
        unionset(e.u.id, e.v.id);
        tol--;
      }
    }
  }
  if (tol == 1) return true;
  if (tol > 4) return false;
  if (tol == 2) {
    for (auto e : edg) {
      if (find(e.u.id) != find(e.v.id) && 1ll * e.length() <= 1ll * 2 * T)
        return true;
    }
    for (i = 1; i <= N; ++i) {
      for (j = i + 1; j <= N; ++j) {
        if (find(i) != find(j)) {
          if (max(abs(vc[i].x - vc[j].x), abs(vc[i].y - vc[j].y)) <= T)
            return true;
        }
      }
    }
    return false;
  } else if (tol == 3) {
    int sz = edg.size();
    for (i = 0; i < sz; ++i) {
      for (j = 1; j <= N; ++j) {
        if (find(j) != find(edg[i].u.id) && find(j) != find(edg[i].v.id) &&
            find(edg[i].v.id) != find(edg[i].u.id)) {
          if (edg[i].ishorizontal()) {
            int x1 = edg[i].u.x, x2 = edg[i].v.x;
            if (x1 > x2) swap(x1, x2);
            if (x1 <= vc[j].x && vc[j].x <= x2) {
              int dist = max(abs(vc[j].y - edg[i].u.y),
                             max(x2 - vc[j].x, vc[j].x - x1));
              if (dist <= T) return true;
            }
          } else {
            int y1 = edg[i].u.y, y2 = edg[i].v.y;
            if (y1 > y2) swap(y1, y2);
            if (y1 <= vc[j].y && vc[j].y <= y2) {
              int dist = max(abs(vc[j].x - edg[i].u.x),
                             max(y2 - vc[j].y, vc[j].y - y1));
              if (dist <= T) return true;
            }
          }
        }
      }
    }
    return false;
  }
  int sz = edg.size();
  for (i = 0; i < sz; ++i) {
    if (edg[i].ishorizontal() || find(edg[i].u.id) == find(edg[i].v.id))
      continue;
    int y1 = min(edg[i].u.y, edg[i].v.y), y2 = max(edg[i].u.y, edg[i].v.y);
    for (j = i + 1; j < sz; ++j) {
      if (edg[j].isvertical() || find(edg[j].u.id) == find(edg[j].v.id))
        continue;
      if (find(edg[i].u.id) == find(edg[j].u.id)) continue;
      if (find(edg[i].u.id) == find(edg[j].v.id)) continue;
      if (find(edg[i].v.id) == find(edg[j].u.id)) continue;
      if (find(edg[i].v.id) == find(edg[j].v.id)) continue;
      int x1 = min(edg[j].u.x, edg[j].v.x), x2 = max(edg[j].u.x, edg[j].v.x);
      int x = edg[i].v.x, y = edg[j].v.y;
      if (x1 <= x && x <= x2 && y1 <= y && y <= y2) {
        if (max(max(x - x1, x2 - x), max(y - y1, y2 - y)) <= T) return true;
      }
    }
  }
  return false;
}
int main() {
  int i;
  scanf("%d", &N);
  for (i = 1; i <= N; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    X[x].emplace_back(y, i);
    Y[y].emplace_back(x, i);
    vc[i].x = x, vc[i].id = i, vc[i].y = y;
  }
  preprocess();
  int low = 0, high = 2e9, ans = -1;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    if (valid(mid)) {
      high = mid - 1;
      ans = mid;
    } else {
      low = mid + 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
