#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, int>;
using vi = vector<int>;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  string sep = "";
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename A>
ostream &operator<<(ostream &os, const set<A> &s) {
  os << '{';
  string sep = "";
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const map<A, B> &m) {
  os << '{';
  string sep = "";
  for (const auto &x : m)
    os << sep << x.first << " -> " << x.second, sep = ", ";
  return os << '}';
}
constexpr int inf = 0x3f3f3f3f;
constexpr int maxn = 1e3 + 10;
constexpr int mod = 1000000007;
int n;
struct DSU {
  int pai[maxn], peso[maxn], cc;
  DSU() {
    cc = n;
    for (int i = 0; i < n; i++) pai[i] = i, peso[i] = 0;
  }
  int find(int a) {
    if (pai[a] == a) return a;
    return pai[a] = find(pai[a]);
  }
  void join(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return;
    cc--;
    if (peso[a] < peso[b]) swap(a, b);
    pai[b] = a;
    peso[a] += peso[b];
  }
};
struct Edge {
  int a, b, w;
  friend ostream &operator<<(ostream &os, Edge e) {
    return os << e.a << ' ' << e.b << ' ' << e.w;
  }
  bool operator==(Edge oto) { return a == oto.a && b == oto.b && w == oto.w; }
};
vector<Edge> edges;
vector<piii> pt;
bool check(int t) {
  DSU dsu;
  for (auto e : edges)
    if (e.w <= t) dsu.join(e.a, e.b);
  if (dsu.cc == 1) {
    return 1;
  }
  if (dsu.cc > 4) return 0;
  vector<vector<pii>> pts(dsu.cc);
  map<int, int> mp;
  int aux = 0;
  for (int i = 0; i < n; i++)
    if (!mp[dsu.find(i)]) mp[dsu.find(i)] = ++aux;
  for (auto &it : mp) it.second--;
  for (int i = 0; i < n; i++)
    pts[mp[dsu.find(i)]].push_back({pt[i].first.first, pt[i].first.second});
  if (dsu.cc == 2) {
    ;
    for (auto a : pts[0]) {
      for (auto b : pts[1]) {
        ;
        if (abs(a.first - b.first) <= t && abs(a.second - b.second) <= t)
          return 1;
      }
    }
    for (auto e : edges) {
      if (dsu.find(e.a) != dsu.find(e.b) && e.w <= 2 * t) return 1;
    }
    return 0;
  } else if (dsu.cc == 3) {
    for (auto e : edges) {
      if (dsu.find(e.a) == dsu.find(e.b)) continue;
      vector<int> mark(3);
      int use = -1;
      mark[mp[dsu.find(e.a)]] = 1, mark[mp[dsu.find(e.b)]] = 1;
      for (int i = 0; i < 3; i++)
        if (!mark[i]) use = i;
      assert(use != -1);
      if (pt[e.a].first.first == pt[e.b].first.first) {
        for (auto p : pts[use]) {
          if (abs(p.first - pt[e.a].first.first) <= t &&
              abs(p.second - pt[e.a].first.second) <= t &&
              abs(p.second - pt[e.b].first.second) <= t)
            return 1;
        }
      } else {
        for (auto p : pts[use]) {
          if (abs(p.second - pt[e.a].first.second) <= t &&
              abs(p.first - pt[e.a].first.first) <= t &&
              abs(p.first - pt[e.b].first.first) <= t)
            return 1;
        }
      }
    }
    return 0;
  } else {
    for (auto e1 : edges) {
      for (auto e2 : edges) {
        if (e1 == e2) continue;
        vector<int> mark(4);
        mark[mp[dsu.find(e1.a)]] = 1;
        mark[mp[dsu.find(e1.b)]] = 1;
        mark[mp[dsu.find(e2.a)]] = 1;
        mark[mp[dsu.find(e2.b)]] = 1;
        bool ok = 1;
        for (int i = 0; i < 4; i++)
          if (!mark[i]) ok = 0;
        if (!ok) continue;
        pii lixo = {0, 0};
        pii h1 = lixo, h2 = lixo, v1 = lixo, v2 = lixo;
        if (pt[e1.a].first.first == pt[e1.b].first.first)
          v1 = {pt[e1.a].first.first, pt[e1.a].first.second},
          v2 = {pt[e1.b].first.first, pt[e1.b].first.second};
        if (pt[e2.a].first.first == pt[e2.b].first.first)
          v1 = {pt[e2.a].first.first, pt[e2.a].first.second},
          v2 = {pt[e2.b].first.first, pt[e2.b].first.second};
        if (v1.second > v2.second) swap(v1, v2);
        if (pt[e1.a].first.second == pt[e1.b].first.second)
          h1 = {pt[e1.a].first.first, pt[e1.a].first.second},
          h2 = {pt[e1.b].first.first, pt[e1.b].first.second};
        if (pt[e2.a].first.second == pt[e2.b].first.second)
          h1 = {pt[e2.a].first.first, pt[e2.a].first.second},
          h2 = {pt[e2.b].first.first, pt[e2.b].first.second};
        if (h1.first > h2.first) swap(h1, h2);
        if ((h1 == lixo && h2 == lixo) || (v1 == lixo && v2 == lixo)) continue;
        int val = max({abs(h2.first - v1.first), abs(h1.first - v1.first),
                       abs(v1.second - h1.second), abs(v2.second - h1.second)});
        if (val <= t) return 1;
      }
    }
    return 0;
  }
}
int main() {
  scanf("%d", &n);
  pt.resize(n);
  for (int i = 0; i < n; i++)
    scanf("%d %d", &pt[i].first.first, &pt[i].first.second), pt[i].second = i;
  sort((pt).begin(), (pt).end());
  for (int i = 1; i < n; i++)
    if (pt[i].first.first == pt[i - 1].first.first)
      edges.push_back({pt[i].second, pt[i - 1].second,
                       pt[i].first.second - pt[i - 1].first.second});
  sort((pt).begin(), (pt).end(), [](piii a, piii b) {
    if (a.first.second == b.first.second) return a.first.first < b.first.first;
    return a.first.second < b.first.second;
  });
  for (int i = 1; i < n; i++)
    if (pt[i].first.second == pt[i - 1].first.second)
      edges.push_back({pt[i].second, pt[i - 1].second,
                       pt[i].first.first - pt[i - 1].first.first});
  sort((pt).begin(), (pt).end(),
       [](piii a, piii b) { return a.second < b.second; });
  int l = 0, r = 2e9 + 10, ans = -1;
  while (l <= r) {
    int mid = l + ((r - l) >> 1);
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", ans);
}
