#include <bits/stdc++.h>
const long long MaxN = 1e3 + 10;
long long n, x[MaxN], y[MaxN], f[MaxN];
std::unordered_map<long long, long long> trash;
std::map<long long, std::vector<long long>> lx, ly;
std::vector<std::pair<long long, long long>> X, Y, line;
long long Abs(long long x) { return (x < 0) ? (-x) : x; }
long long cmpx(long long a, long long b) { return x[a] < x[b]; }
long long cmpy(long long a, long long b) { return y[a] < y[b]; }
long long getf(long long x) {
  if (x != f[x]) f[x] = getf(f[x]);
  return f[x];
}
void merge(long long x, long long y) {
  long long fx = getf(x), fy = getf(y);
  if (fx != fy) f[fx] = fy;
}
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0')
    x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? x : (-x);
}
long long check(long long mid) {
  trash.clear();
  for (long long i = 1; i <= n; i++) f[i] = i;
  for (std::map<long long, std::vector<long long>>::iterator it = lx.begin();
       it != lx.end(); it++) {
    std::vector<long long> &v = it->second;
    for (long long i = 1; i < v.size(); i++)
      if (Abs(y[v[i]] - y[v[i - 1]]) <= mid) merge(v[i], v[i - 1]);
  }
  for (std::map<long long, std::vector<long long>>::iterator it = ly.begin();
       it != ly.end(); it++) {
    std::vector<long long> &v = it->second;
    for (long long i = 1; i < v.size(); i++)
      if (Abs(x[v[i]] - x[v[i - 1]]) <= mid) merge(v[i], v[i - 1]);
  }
  long long siz = 0;
  for (long long i = 1; i <= n; i++)
    siz += (trash[getf(i)] == 0), trash[getf(i)] = 1;
  if (siz == 1)
    return 1;
  else if (siz == 2) {
    for (long long i = 1; i <= n; i++)
      for (long long j = i + 1; j <= n; j++)
        if (f[i] != f[j]) {
          if (Abs(x[i] - x[j]) == 0 && Abs(y[i] - y[j]) <= 2 * mid) return 1;
          if (Abs(y[i] - y[j]) == 0 && Abs(x[i] - x[j]) <= 2 * mid) return 1;
          if (Abs(x[i] - x[j]) <= mid && Abs(y[i] - y[j]) <= mid) return 1;
        }
  } else if (siz == 3) {
    line.clear();
    for (std::map<long long, std::vector<long long>>::iterator it = lx.begin();
         it != lx.end(); it++) {
      std::vector<long long> &v = it->second;
      for (long long i = 1; i < v.size(); i++)
        if (f[v[i]] != f[v[i - 1]])
          line.push_back(std::make_pair(v[i], v[i - 1]));
    }
    for (std::map<long long, std::vector<long long>>::iterator it = ly.begin();
         it != ly.end(); it++) {
      std::vector<long long> &v = it->second;
      for (long long i = 1; i < v.size(); i++)
        if (f[v[i]] != f[v[i - 1]])
          line.push_back(std::make_pair(v[i], v[i - 1]));
    }
    for (auto li : line) {
      long long l = li.first, r = li.second;
      for (long long i = 1; i <= n; i++) {
        if (f[l] != f[i] && f[i] != f[r]) {
          if (x[l] == x[r]) {
            if (Abs(y[l] - y[i]) <= mid && Abs(y[r] - y[i]) <= mid)
              if (Abs(x[l] - x[i]) <= mid) return 1;
          } else if (Abs(x[l] - x[i]) <= mid && Abs(x[r] - x[i]) <= mid)
            if (Abs(y[l] - y[i]) <= mid) return 1;
        }
      }
    }
  } else if (siz == 4) {
    X.clear(), Y.clear();
    for (std::map<long long, std::vector<long long>>::iterator it = lx.begin();
         it != lx.end(); it++) {
      std::vector<long long> &v = it->second;
      for (long long i = 1; i < v.size(); i++)
        if (f[v[i]] != f[v[i - 1]]) X.push_back(std::make_pair(v[i], v[i - 1]));
    }
    for (std::map<long long, std::vector<long long>>::iterator it = ly.begin();
         it != ly.end(); it++) {
      std::vector<long long> &v = it->second;
      for (long long i = 1; i < v.size(); i++)
        if (f[v[i]] != f[v[i - 1]]) Y.push_back(std::make_pair(v[i], v[i - 1]));
    }
    for (auto x1 : X) {
      for (auto y1 : Y) {
        long long a = x1.first, b = x1.second;
        long long c = y1.first, d = y1.second;
        if (f[a] != f[c] && f[a] != f[d])
          if (f[b] != f[c] && f[b] != f[d])
            if (Abs(x[a] - x[c]) <= mid && Abs(x[a] - x[d]) <= mid)
              if (Abs(y[c] - y[a]) <= mid && Abs(y[c] - y[b]) <= mid) return 1;
      }
    }
  }
  return 0;
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) {
    x[i] = read(), y[i] = read();
    lx[x[i]].push_back(i);
    ly[y[i]].push_back(i);
  }
  for (std::map<long long, std::vector<long long>>::iterator it = lx.begin();
       it != lx.end(); it++) {
    std::vector<long long> &v = it->second;
    std::sort(v.begin(), v.end(), cmpy);
  }
  for (std::map<long long, std::vector<long long>>::iterator it = ly.begin();
       it != ly.end(); it++) {
    std::vector<long long> &v = it->second;
    std::sort(v.begin(), v.end(), cmpx);
  }
  long long l = 1, r = 0x7f7f7f7f;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (l == 0x7f7f7f7f) l = -1;
  printf("%lld\n", l);
  return 0;
}
