#include <bits/stdc++.h>
#pragma GCC optimize("O3", "Ofast", "unroll-loops", "omit-frame-pointer", \
                     "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
using namespace std;
struct COORDINATE_COMPRESSION {
  vector<int> vect;
  int size() { return vect.size(); }
  void clear() { vect.clear(); }
  void insert(int x) { vect.push_back(x); }
  void compress() {
    sort(vect.begin(), vect.end());
    vect.resize(unique(vect.begin(), vect.end()) - vect.begin());
  }
  int get(int x) {
    return lower_bound(vect.begin(), vect.end(), x) - vect.begin();
  }
  int iget(int x) {
    assert(0 <= x && x < vect.size());
    return vect[x];
  }
} mp1, mp2;
struct point {
  int x, y;
};
const int MAXN = 2010;
int arr[MAXN][MAXN][4];
vector<pair<int, pair<int, int>>> edge;
vector<point> vect;
bool f(int N, int mid) {
  vector<int> L[N];
  vector<int> comp(N);
  vector<bool> mk(N);
  for (int i = 0; i < edge.size(); i++) {
    if (edge[i].first <= mid) {
      L[edge[i].second.first].push_back(edge[i].second.second);
      L[edge[i].second.second].push_back(edge[i].second.first);
    }
  }
  int contg = 0;
  function<void(int)> DFS = [&](int nodo) {
    mk[nodo] = true;
    comp[nodo] = contg;
    for (auto v : L[nodo]) {
      if (!mk[v]) {
        DFS(v);
      }
    }
  };
  for (int i = 0; i < N; i++) {
    if (!mk[i]) {
      contg++;
      DFS(i);
    }
  }
  for (int i = 0; i < mp1.size(); i++) {
    for (int j = 0; j < mp2.size(); j++) {
      set<int> st;
      if (arr[i][j][0] != -1 &&
          abs(mp1.iget(i) - mp1.iget(vect[arr[i][j][0]].x)) <= mid)
        st.insert(comp[arr[i][j][0]]);
      if (arr[i][j][1] != -1 &&
          abs(mp2.iget(j) - mp2.iget(vect[arr[i][j][1]].y)) <= mid)
        st.insert(comp[arr[i][j][1]]);
      if (arr[i][j][2] != -1 &&
          abs(mp1.iget(i) - mp1.iget(vect[arr[i][j][2]].x)) <= mid)
        st.insert(comp[arr[i][j][2]]);
      if (arr[i][j][3] != -1 &&
          abs(mp2.iget(j) - mp2.iget(vect[arr[i][j][3]].y)) <= mid)
        st.insert(comp[arr[i][j][3]]);
      if (st.size() == contg) return true;
    }
  }
  return false;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> v1, v2;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    vect.push_back({x, y});
    v1.push_back(x);
    v2.push_back(y);
  }
  sort(v1.begin(), v1.end());
  v1.resize(unique(v1.begin(), v1.end()) - v1.begin());
  sort(v2.begin(), v2.end());
  v2.resize(unique(v2.begin(), v2.end()) - v2.begin());
  for (int i = 0; i < v1.size(); i++) {
    mp1.insert(v1[i]);
    if (i) mp1.insert((v1[i] + v1[i - 1]) / 2);
  }
  for (int i = 0; i < v2.size(); i++) {
    mp2.insert(v2[i]);
    if (i) mp2.insert((v2[i] + v2[i - 1]) / 2);
  }
  mp1.compress();
  mp2.compress();
  for (int i = 0; i < N; i++) {
    vect[i].x = mp1.get(vect[i].x);
    vect[i].y = mp2.get(vect[i].y);
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if (vect[i].y == vect[j].y) {
        edge.push_back(
            {abs(mp1.iget(vect[i].x) - mp1.iget(vect[j].x)), {i, j}});
      }
      if (vect[i].x == vect[j].x) {
        edge.push_back(
            {abs(mp2.iget(vect[i].y) - mp2.iget(vect[j].y)), {i, j}});
      }
    }
  }
  sort(edge.begin(), edge.end());
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      for (int k = 0; k < 4; k++) {
        arr[i][j][k] = -1;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    for (int k = 0; k < 4; k++) {
      arr[vect[i].x][vect[i].y][k] = i;
    }
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      if (i != 0 && arr[i][j][0] == -1) arr[i][j][0] = arr[i - 1][j][0];
    }
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      if (j != 0 && arr[i][j][1] == -1) arr[i][j][1] = arr[i][j - 1][1];
    }
  }
  for (int i = MAXN - 1; i >= 0; i--) {
    for (int j = MAXN - 1; j >= 0; j--) {
      if (i != MAXN - 1 && arr[i][j][2] == -1) arr[i][j][2] = arr[i + 1][j][2];
    }
  }
  for (int i = MAXN - 1; i >= 0; i--) {
    for (int j = MAXN - 1; j >= 0; j--) {
      if (j != MAXN - 1 && arr[i][j][3] == -1) arr[i][j][3] = arr[i][j + 1][3];
    }
  }
  long long a = 0, b = 2e9, res = -1;
  while (a <= b) {
    long long mid = (a + b) / 2;
    if (f(N, mid)) {
      b = mid - 1;
      res = mid;
    } else {
      a = mid + 1;
    }
  }
  cout << res << '\n';
  return 0;
}
