#include <bits/stdc++.h>
using namespace std;
struct dsu {
  vector<int> g;
  dsu(int n) { g = vector<int>(n, -1); }
  int get(int u) { return g[u] < 0 ? u : g[u] = get(g[u]); }
  bool merge(int u, int v) {
    u = get(u), v = get(v);
    if (u == v) return false;
    if (u > v) swap(u, v);
    g[u] += g[v];
    g[v] = u;
    return true;
  }
  int size(int u) { return -g[get(u)]; }
  vector<vector<int>> split() {
    map<int, int> mp;
    vector<vector<int>> res;
    int cnt = 0;
    for (int i = 0; i < (int)g.size(); i++) {
      int gi = get(i);
      if (mp.count(gi)) {
        res[mp[gi]].push_back(i);
      } else {
        mp[gi] = cnt++;
        res.push_back({i});
      }
    }
    return res;
  }
};
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int n;
  cin >> n;
  vector<array<int, 2>> a(n);
  for (auto& it : a) {
    cin >> it[0] >> it[1];
  }
  auto dist = [&](int u, int v, int xy) { return abs(a[u][xy] - a[v][xy]); };
  vector<array<int, 3>> edges;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i][0] == a[j][0]) {
        edges.push_back({dist(i, j, 1), i, j});
      } else if (a[i][1] == a[j][1]) {
        edges.push_back({dist(i, j, 0), i, j});
      }
    }
  }
  sort(edges.begin(), edges.end());
  int low = 0, high = 2e9 + 5, answer = -1;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    dsu d(n);
    for (const auto& e : edges) {
      if (e[0] > mid) break;
      d.merge(e[1], e[2]);
    }
    auto g = d.split();
    int groups = g.size();
    bool ok = (groups == 1);
    if (groups == 2) {
      for (int u : g[0]) {
        for (int v : g[1]) {
          int dx = dist(u, v, 0), dy = dist(u, v, 1);
          if ((max(dx, dy) <= mid) ||
              (a[u][0] == a[v][0] && (dy + 1) / 2 <= mid) ||
              (a[u][1] == a[v][1] && (dx + 1) / 2 <= mid)) {
            ok = true;
            break;
          }
        }
        if (ok) break;
      }
    } else if (groups == 3) {
      vector<array<int, 3>> lines;
      for (int i = 0; i < 3; i++) {
        int j = (i + 1) % 3;
        int k = (i + 2) % 3;
        for (int u : g[i]) {
          for (int v : g[j]) {
            if (a[u][0] == a[v][0] || a[u][1] == a[v][1]) {
              lines.push_back({u, v, k});
            }
          }
        }
      }
      for (const auto& e : lines) {
        auto u = a[e[0]], v = a[e[1]];
        int check = int(u[0] == v[0]);
        if (u[check] > v[check]) swap(u, v);
        for (int w : g[e[2]]) {
          const auto& k = a[w];
          if (u[check] <= k[check] && k[check] <= v[check] &&
              max({v[check] - k[check], k[check] - u[check],
                   abs(k[check ^ 1] - u[check ^ 1])}) <= mid) {
            ok = true;
            break;
          }
        }
        if (ok) break;
      }
    } else if (groups == 4) {
      vector<array<int, 4>> vert, hori;
      for (int i = 0; i < 4; i++) {
        for (int j = i + 1; j < 4; j++) {
          for (int u : g[i]) {
            for (int v : g[j]) {
              if (a[u][0] == a[v][0]) {
                if (a[u][1] < a[v][1])
                  vert.push_back({u, v, i, j});
                else
                  vert.push_back({v, u, i, j});
              } else if (a[u][1] == a[v][1]) {
                if (a[u][0] < a[v][0])
                  hori.push_back({u, v, i, j});
                else
                  hori.push_back({v, u, i, j});
              }
            }
          }
        }
      }
      for (auto& v : vert) {
        for (auto& h : hori) {
          bool bad = false;
          for (int vi : {2, 3})
            for (int hi : {2, 3}) bad |= (v[vi] == h[hi]);
          if (bad) continue;
          int x = a[v[0]][0], y = a[h[0]][1];
          if (y < a[v[0]][1] || a[v[1]][1] < y || x < a[h[0]][0] ||
              a[h[1]][0] < x) {
            continue;
          }
          if (max({y - a[v[0]][1], a[v[1]][1] - y, x - a[h[0]][0],
                   a[h[1]][0] - x}) <= mid) {
            ok = true;
            break;
          }
        }
        if (ok) break;
      }
    }
    if (ok) {
      answer = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  cout << answer << '\n';
  return 0;
}
