#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 1e3 + 5;
inline long long R() {
  char ch = getchar();
  long long x = 0;
  bool f = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
  if (f == 1) x = -x;
  return x;
}
vector<long long> a[Maxn * 2], b[Maxn * 2];
const long long inf = 0x3fffffffffffffff;
long long Abs(long long X) { return X < 0 ? -X : X; }
long long x[Maxn], y[Maxn], n, h[Maxn * 2], cnt, fa[Maxn * 2], L;
long long f(long long X) { return fa[X] == X ? X : fa[X] = f(fa[X]); }
bool vis[Maxn];
bool cmp1(long long X, long long Y) { return x[X] < x[Y]; }
bool cmp2(long long X, long long Y) { return y[X] < y[Y]; }
inline bool ck(long long V) {
  memset(vis, 0, sizeof vis);
  for (long long i = 1; i <= n; i++) fa[i] = i;
  for (long long i = 1; i <= n; i++)
    for (long long j = i + 1; j <= n; j++)
      if (x[i] == x[j] || y[i] == y[j])
        if (Abs(h[x[i]] - h[x[j]]) + Abs(h[y[i]] - h[y[j]]) <= V)
          fa[f(i)] = f(j);
  long long N = 0;
  for (long long i = 1; i <= n; i++)
    if (!vis[f(i)]) {
      vis[f(i)] = 1;
      ++N;
    }
  if (N == 1) return 1;
  if (N > 4) return 0;
  if (N == 2) {
    for (long long i = 1; i <= n; i++)
      for (long long j = i + 1; j <= n; j++)
        if (f(i) != f(j)) {
          if (x[i] == x[j] || y[i] == y[j]) {
            if (Abs(h[x[i]] - h[x[j]]) + Abs(h[y[i]] - h[y[j]]) <= 2 * V)
              return 1;
          } else if (max(Abs(h[x[i]] - h[x[j]]), Abs(h[y[i]] - h[y[j]])) <= V)
            return 1;
        }
  }
  if (N == 3) {
    for (long long i = 1; i <= L; i++)
      for (long long j = 1; j < a[i].size(); j++)
        if (f(a[i][j]) != f(a[i][j - 1]))
          for (long long k = 1; k <= n; k++)
            if (f(k) != f(a[i][j]) && f(k) != f(a[i][j - 1])) {
              if (max(Abs(h[i] - h[y[k]]), Abs(h[x[a[i][j]]] - h[x[k]])) <= V)
                if (max(Abs(h[i] - h[y[k]]),
                        Abs(h[x[a[i][j - 1]]] - h[x[k]])) <= V)
                  return 1;
            }
    for (long long i = 1; i <= L; i++)
      for (long long j = 1; j < b[i].size(); j++)
        if (f(b[i][j]) != f(b[i][j - 1]))
          for (long long k = 1; k <= n; k++)
            if (f(k) != f(b[i][j]) && f(k) != f(b[i][j - 1])) {
              if (max(Abs(h[i] - h[x[k]]), Abs(h[y[b[i][j]]] - h[y[k]])) <= V)
                if (max(Abs(h[i] - h[x[k]]),
                        Abs(h[y[b[i][j - 1]]] - h[y[k]])) <= V)
                  return 1;
            }
  }
  if (N == 4) {
    for (long long i = 1; i <= L; i++)
      for (long long j = 1; j < a[i].size(); j++)
        if (f(a[i][j]) != f(a[i][j - 1]))
          for (long long I = 1; I <= L; I++)
            for (long long J = 1; J < b[I].size(); J++)
              if (f(b[I][J]) != f(b[I][J - 1]))
                if (f(a[i][j]) != f(b[I][J]) && f(a[i][j - 1]) != f(b[I][J]) &&
                    f(a[i][j]) != f(b[I][J - 1]) &&
                    f(a[i][j - 1]) != f(b[I][J - 1])) {
                  if (max(Abs(h[i] - h[y[b[I][J]]]),
                          Abs(h[x[a[i][j]]] - h[I])) <= V)
                    if (max(Abs(h[i] - h[y[b[I][J]]]),
                            Abs(h[x[a[i][j - 1]]] - h[I])) <= V)
                      if (max(Abs(h[i] - h[y[b[I][J - 1]]]),
                              Abs(h[x[a[i][j]]] - h[I])) <= V)
                        if (max(Abs(h[i] - h[y[b[I][J - 1]]]),
                                Abs(h[x[a[i][j - 1]]] - h[I])) <= V)
                          return 1;
                }
  }
  return 0;
}
signed main() {
  n = R();
  for (long long i = 1; i <= n; i++) {
    x[i] = R();
    y[i] = R();
    h[++cnt] = x[i];
    h[++cnt] = y[i];
  }
  sort(h + 1, h + 1 + cnt);
  L = unique(h + 1, h + 1 + cnt) - h;
  for (long long i = 1; i <= n; i++) {
    x[i] = lower_bound(h + 1, h + L, x[i]) - h;
    y[i] = lower_bound(h + 1, h + L, y[i]) - h;
    a[y[i]].push_back(i);
    b[x[i]].push_back(i);
  }
  for (long long i = 1; i <= L; i++) {
    sort(a[i].begin(), a[i].end(), cmp1);
    sort(b[i].begin(), b[i].end(), cmp2);
  }
  long long l = 0, r = inf;
  ck(1);
  while (l <= r) {
    if (ck((l + r >> 1)))
      r = (l + r >> 1) - 1;
    else
      l = (l + r >> 1) + 1;
  }
  if (r >= 2e9)
    puts("-1");
  else
    printf("%lld\n", r + 1);
}
