#include <bits/stdc++.h>
using namespace std;
inline int ab(int x) { return x > 0 ? x : -x; }
int par[1010], ex[1010];
int find(int x) { return par[x] == x ? x : (par[x] = find(par[x])); }
int n;
int x[1010], y[1010], xi[1010], yi[1010];
vector<int> xs, ys;
vector<pair<int, int> > gx[1010], gy[1010];
int w[1010][1010][2];
int can(int mid) {
  for (int i = 0; i < n; i++) {
    par[i] = i;
    ex[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (x[i] == x[j] && ab(y[i] - y[j]) <= mid ||
          y[i] == y[j] && ab(x[i] - x[j]) <= mid) {
        par[find(i)] = find(j);
      }
    }
  }
  int c = 0;
  for (int i = 0; i < n; i++) {
    ex[find(i)] = 1;
  }
  for (int i = 0; i < n; i++) {
    c += ex[i];
  }
  if (c == 1) return 1;
  if (c > 4) return 0;
  int t[4];
  for (int i = 0; i < xs.size(); i++) {
    for (int j = 0; j < ys.size(); j++) {
      int px = w[i][j][0], py = w[i][j][1];
      t[0] = t[1] = t[2] = t[3] = -1;
      if (px > 0 && ab(ys[j] - gx[i][px - 1].first) <= mid) {
        t[0] = find(gx[i][px - 1].second);
      }
      if (px < gx[i].size() && ab(ys[j] - gx[i][px].first) <= mid) {
        t[1] = find(gx[i][px].second);
      }
      if (py > 0 && ab(xs[i] - gy[j][py - 1].first) <= mid) {
        t[2] = find(gy[j][py - 1].second);
      }
      if (py < gy[j].size() && ab(xs[i] - gy[j][py].first) <= mid) {
        t[3] = find(gy[j][py].second);
      }
      sort(t, t + 4);
      int u = unique(t, t + 4) - t;
      if (t[0] == -1) --u;
      if (c == u) return 1;
    }
  }
  if (c > 2) return 0;
  for (int i = 0; i < xs.size(); i++) {
    for (int j = 1; j < gx[i].size(); j++) {
      if (gx[i][j].first - gx[i][j - 1].first <= 2ll * mid) {
        if (find(gx[i][j].second) != find(gx[i][j - 1].second)) return 1;
      }
    }
  }
  for (int i = 0; i < ys.size(); i++) {
    for (int j = 1; j < gy[i].size(); j++) {
      if (gy[i][j].first - gy[i][j - 1].first <= 2ll * mid) {
        if (find(gy[i][j].second) != find(gy[i][j - 1].second)) return 1;
      }
    }
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x[i], &y[i]);
    xs.push_back(x[i]);
    ys.push_back(y[i]);
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());
  xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
  ys.resize(unique(ys.begin(), ys.end()) - ys.begin());
  for (int i = 0; i < n; i++) {
    xi[i] = lower_bound(xs.begin(), xs.end(), x[i]) - xs.begin();
    yi[i] = lower_bound(ys.begin(), ys.end(), y[i]) - ys.begin();
    gx[xi[i]].push_back(make_pair(y[i], i));
    gy[yi[i]].push_back(make_pair(x[i], i));
  }
  for (int i = 0; i < xs.size(); i++) {
    sort(gx[i].begin(), gx[i].end());
  }
  for (int i = 0; i < ys.size(); i++) {
    sort(gy[i].begin(), gy[i].end());
  }
  for (int i = 0; i < xs.size(); i++) {
    for (int j = 0; j < ys.size(); j++) {
      int px = lower_bound(gx[i].begin(), gx[i].end(), make_pair(ys[j], -1)) -
               gx[i].begin();
      w[i][j][0] = px;
      int py = lower_bound(gy[j].begin(), gy[j].end(), make_pair(xs[i], -1)) -
               gy[j].begin();
      w[i][j][1] = py;
    }
  }
  int lo = 0, hi = 2000000001;
  if (!can(hi)) {
    puts("-1");
    return 0;
  }
  while (lo + 1 < hi) {
    int mid = (hi - lo) / 2 + lo;
    if (can(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  printf("%d\n", hi);
  return 0;
}
