#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long MOD = 1e9 + 7;
double eps = 1e-12;
long long mpow(long long a, long long b) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long t1 = mpow(a, b / 2);
  t1 *= t1;
  t1 %= MOD;
  if (b % 2) t1 *= a;
  t1 %= MOD;
  return t1;
}
long long mpow(long long a, long long b, long long p) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long t1 = mpow(a, b / 2, p);
  t1 *= t1;
  t1 %= p;
  if (b % 2) t1 *= a;
  t1 %= p;
  return t1;
}
long long modinverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
long long range(long long l, long long r) { return l + mt() % (r - l + 1); }
long long rev(long long v) { return mpow(v, MOD - 2); }
class UnionFind {
  vector<long long> p, rank, sz;

 public:
  UnionFind(long long N) {
    rank.assign(N, 0);
    p.assign(N, 0);
    sz.assign(N, 1);
    for (long long i = 0; i < N; i++) p[i] = i;
  }
  void inc() {
    rank.push_back(0);
    p.push_back(((long long)(p).size()));
    sz.push_back(1);
  }
  long long findSet(long long i) {
    return (p[i] == i) ? i : (p[i] = findSet(p[i]));
  }
  bool isSameSet(long long i, long long j) { return findSet(i) == findSet(j); }
  void unionSet(long long i, long long j) {
    if (!isSameSet(i, j)) {
      long long x = findSet(i), y = findSet(j);
      if (rank[x] > rank[y]) {
        p[y] = x;
        sz[x] += sz[y];
      } else {
        p[x] = y;
        if (rank[x] == rank[y]) rank[y]++;
        sz[y] += sz[x];
      }
    }
  }
  long long sz1(long long i) { return sz[i]; }
};
void solve() {
  long long n;
  cin >> n;
  long long x[n], y[n];
  long long cx[n], cy[n];
  set<long long> xs, ys;
  for (long long i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    xs.insert(x[i]);
    ys.insert(y[i]);
  }
  unordered_map<long long, long long> rx, ry;
  long long index = 0;
  for (auto it : xs) rx[it] = index++;
  index = 0;
  for (auto it : ys) ry[it] = index++;
  for (long long i = 0; i < n; i++) {
    cx[i] = rx[x[i]], cy[i] = ry[y[i]];
  }
  long long l = 1, r = 2e9 + 5;
  while (l != r) {
    long long mid = (l + r) / 2;
    UnionFind U(n);
    long long dc = n;
    for (long long i = 0; i < n; i++) {
      for (long long j = i + 1; j < n; j++) {
        if ((x[i] == x[j] && abs(y[i] - y[j]) <= mid) ||
            (y[i] == y[j] && abs(x[i] - x[j]) <= mid)) {
          if (!U.isSameSet(i, j)) {
            dc--;
            U.unionSet(i, j);
          }
        }
      }
    }
    bool bo = 0;
    if (dc == 1)
      bo = 1;
    else if (dc > 4)
      bo = 0;
    else {
      long long factor = 1e3 + 5;
      vector<long long> m(1e6 + 1e4, 0);
      long long sv = 0;
      long long ms = 0;
      long long pr[n], rv[n];
      for (long long i = 0; i < n; i++) {
        pr[i] = U.findSet(i);
        if (pr[i] == i) {
          rv[i] = sv++;
        }
      }
      for (long long i = 0; i < n; i++) {
        for (long long j = i + 1; j < n; j++) {
          if (pr[i] == pr[j]) continue;
          if (abs(x[i] - x[j]) <= mid && abs(y[i] - y[j]) <= mid) {
            long long a1 = rv[pr[i]], a2 = rv[pr[j]];
            if (a1 > a2) swap(a1, a2);
            long long cur = (1 << (4 * a1 + a2 - 1));
            m[factor * cx[i] + cy[j]] |= cur;
            ms = max(
                ms, (long long)__builtin_popcountll(m[factor * cx[i] + cy[j]]));
            m[factor * cx[j] + cy[i]] |= cur;
            ms = max(
                ms, (long long)__builtin_popcountll(m[factor * cx[j] + cy[i]]));
          }
          if (pr[i] != pr[j] && sv == 2 &&
              ((x[i] == x[j] && abs(y[i] - y[j]) <= 2 * mid) ||
               (y[i] == y[j] && abs(x[i] - x[j]) <= 2 * mid))) {
            bo = 1;
          }
        }
      }
      if (sv == 2 && ms >= 1) bo = 1;
      if (sv == 3 && ms >= 2) bo = 1;
      if (sv == 4 && ms >= 4) bo = 1;
    }
    if (bo)
      r = mid;
    else
      l = mid + 1;
  }
  cout << ((l == 2e9 + 5) ? -1 : l) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
