#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
template <class T>
using vec = std::vector<T>;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
struct Input {
  Input(istream &in) : in(&in) {}
  template <class T>
  T next() const {
    T x;
    *in >> x;
    return x;
  }
  int ni() const { return next<int>(); }
  int64_t ni64() const { return next<int64_t>(); }
  istream *in;
};
Input in(cin);
class Output {
 private:
  ostream *out;
  template <typename T>
  void printSingle(const T &value) {
    *out << value;
  }

 public:
  Output(ostream &out) : out(&out) {}
  inline void print() {}
  template <typename T, typename... Ts>
  inline void print(const T &f, const Ts &...args) {
    printSingle(f);
    if (sizeof...(args) != 0) {
      *out << ' ';
      print(args...);
    }
  }
  template <typename... Ts>
  inline void println(const Ts &...args) {
    print(args...);
    *out << '\n';
  }
  template <typename... Ts>
  inline void operator()(const Ts &...args) {
    println(args...);
  }
};
Output out(cout);
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
namespace dsu {
struct DSU {
  vector<int> parent;
  vector<int> rank;
  vector<int> size;
  DSU(int n) {
    parent = vector<int>(n, 0);
    rank = vector<int>(n, 0);
    size = vector<int>(n, 1);
    for (int i = 0; i < (n); ++i) {
      parent[i] = i;
    }
  }
  bool unite(int a, int b) {
    a = findSet(a);
    b = findSet(b);
    if (a == b) {
      return false;
    }
    int size_a = size[a];
    int size_b = size[b];
    if (rank[a] >= rank[b]) {
      ++rank[b];
      parent[b] = a;
    } else {
      parent[a] = b;
    }
    size[findSet(a)] = size_a + size_b;
    return true;
  }
  int findSet(int v) {
    return (v == parent[v]) ? v : (parent[v] = findSet(parent[v]));
  }
};
}  // namespace dsu
namespace hash_util_detail {
template <class T>
inline void hash_combine(size_t &seed, T const &v) {
  static std::hash<T> h;
  seed ^= h(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
}  // namespace hash_util_detail
namespace std {
template <class U, class V>
struct hash<pair<U, V>> {
  std::size_t operator()(pair<U, V> const &p) const {
    size_t seed = 0;
    hash_util_detail::hash_combine(seed, p.first);
    hash_util_detail::hash_combine(seed, p.second);
    return seed;
  }
};
}  // namespace std
template <typename T>
class Compress {
 public:
  Compress(const vec<T> &o) : mapping(o), compressedOriginal(o) {
    sort(mapping.begin(), mapping.end());
    mapping.resize(unique(mapping.begin(), mapping.end()) - mapping.begin());
    for (int i = 0; i < (compressedOriginal.size()); ++i) {
      compressedOriginal[i] = int(
          lower_bound(mapping.begin(), mapping.end(), compressedOriginal[i]) -
          mapping.begin());
    }
  }
  vec<int> compressed() const { return compressedOriginal; }

 private:
  vec<int> mapping;
  vec<int> compressedOriginal;
};
template <class T>
inline int bitCnt(T mask);
template <>
inline int bitCnt(int32_t mask) {
  return __builtin_popcount(mask);
}
void solve(istream &inStream, ostream &outStream) {
  in = Input(inStream);
  out = Output(outStream);
  auto n = in.ni();
  vec<pair<int64_t, int64_t>> ps(n);
  for (int i = 0; i < (n); ++i) {
    auto xx = in.ni64();
    auto yy = in.ni64();
    ps[i] = {xx, yy};
  }
  auto check = [&](int t) -> bool {
    dsu::DSU dsu(n);
    int countConnectedComponents = n;
    for (int i = 0; i < (n); ++i) {
      for (int j = 0; j < (i); ++j) {
        if (abs(ps[i].first - ps[j].first) <= t &&
            ps[i].second == ps[j].second) {
          if (dsu.unite(i, j)) {
            --countConnectedComponents;
          }
        }
        if (abs(ps[i].second - ps[j].second) <= t &&
            ps[i].first == ps[j].first) {
          if (dsu.unite(i, j)) {
            --countConnectedComponents;
          }
        }
      }
    }
    if (countConnectedComponents >= 5) {
      return false;
    }
    if (countConnectedComponents == 1) return true;
    if (countConnectedComponents == 2) {
      for (int i = 0; i < (n); ++i) {
        for (int j = 0; j < (i); ++j) {
          if (dsu.findSet(i) != dsu.findSet(j)) {
            if (abs(ps[i].second - ps[j].second) <= t &&
                abs(ps[i].first - ps[j].first) <= t) {
              return true;
            }
            if (abs(ps[i].second - ps[j].second) <= 2 * t &&
                ps[i].first == ps[j].first) {
              return true;
            }
            if (abs(ps[i].first - ps[j].first) <= 2 * t &&
                ps[i].second == ps[j].second) {
              return true;
            }
          }
        }
      }
      return false;
    }
    unordered_map<pair<int, int>, int> counts;
    vec<int> leadSet(n);
    for (int i = 0; i < (n); ++i) {
      leadSet[i] = dsu.findSet(i);
    }
    Compress<int> compress(leadSet);
    leadSet = compress.compressed();
    for (int i = 0; i < (n); ++i) {
      for (int j = 0; j < (i); ++j) {
        if (leadSet[i] != leadSet[j]) {
          if (abs(ps[i].second - ps[j].second) <= t &&
              abs(ps[i].first - ps[j].first) <= t) {
            int a = leadSet[i], b = leadSet[j];
            if (a > b) {
              swap(a, b);
            }
            a <<= 2;
            a |= b;
            counts[{ps[i].first, ps[j].second}] |= (1 << a);
            counts[{ps[j].first, ps[i].second}] |= (1 << a);
          }
        }
      }
    }
    int needCount = 2;
    if (countConnectedComponents == 4) {
      needCount = 4;
    }
    for (const auto &countItem : counts) {
      if (bitCnt(countItem.second) >= needCount) {
        return true;
      }
    }
    return false;
  };
  check(1000000000);
  int64_t le = 1, ri = int64_t(2e9), res = -1;
  while (le <= ri) {
    int64_t e = (le + ri) / 2;
    if (check(e)) {
      res = e;
      ri = e - 1;
    } else {
      le = e + 1;
    }
  }
  out(res);
}
int main() {
  solve(cin, cout);
  return 0;
}
