#include <bits/stdc++.h>
std::mt19937_64 rng(
    std::chrono::steady_clock::now().time_since_epoch().count());
long long int myRand(long long int R) {
  long long int val = rng() % R;
  assert(val >= 0);
  return val;
}
const long double PI = atan(1.0) * 4;
const int64_t INF64 = 3e18;
const int32_t INF32 = 2e9 + 7;
const int32_t LOG = 21;
const int32_t MOD = 1e9 + 7;
using namespace std;
void my_debugger(string second, long long int LINE_NUM) { cerr << '\n'; }
template <typename start, typename... end>
void my_debugger(string second, long long int LINE_NUM, start x, end... y) {
  if (second.back() != ',') {
    second += ',';
    cerr << "LINE(" << LINE_NUM << "): ";
  }
  long long int i = second.find(',');
  cerr << second.substr(0, i) << " = " << x;
  second = second.substr(i + 1);
  if (!second.empty()) cerr << ", ";
  my_debugger(second, LINE_NUM, y...);
}
long long int label[1005];
bool check[1005];
vector<long long int> v[1005];
void dfs(long long int i, long long int num) {
  label[i] = num;
  check[i] = true;
  for (auto it : v[i]) {
    if (check[it]) continue;
    dfs(it, num);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  long long int tests = 1;
  for (long long int ii = 0; ii < (long long int)tests; ii++) {
    long long int n;
    cin >> n;
    vector<pair<long long int, long long int>> coor(n);
    map<long long int, vector<pair<long long int, long long int>>> x, y;
    for (long long int i = 0; i < (long long int)n; i++)
      cin >> coor[i].first >> coor[i].second;
    for (long long int i = 0; i < (long long int)n; i++) {
      x[coor[i].first].push_back({coor[i].second, i});
      y[coor[i].second].push_back({coor[i].first, i});
    }
    for (auto& it : x) sort(it.second.begin(), it.second.end());
    for (auto& it : y) sort(it.second.begin(), it.second.end());
    long long int l = 1, r = 2e9;
    long long int ans = INF32;
    while (l <= r) {
      long long int mid = (l + r) >> 1;
      for (long long int i = 0; i < (long long int)n; i++) {
        v[i].clear();
        check[i] = false;
      }
      for (auto& it : x) {
        vector<pair<long long int, long long int>>& vec = it.second;
        for (long long int i = 1; i < (long long int)vec.size(); i++) {
          long long int j = vec[i].second, k = vec[i - 1].second;
          if (vec[i].first - vec[i - 1].first <= mid) {
            v[j].push_back(k);
            v[k].push_back(j);
          }
        }
      }
      for (auto& it : y) {
        vector<pair<long long int, long long int>>& vec = it.second;
        for (long long int i = 1; i < (long long int)vec.size(); i++) {
          long long int j = vec[i].second, k = vec[i - 1].second;
          if (vec[i].first - vec[i - 1].first <= mid) {
            v[j].push_back(k);
            v[k].push_back(j);
          }
        }
      }
      long long int comps = 0;
      for (long long int i = 0; i < (long long int)n; i++) {
        if (check[i]) continue;
        dfs(i, comps++);
      }
      if (comps > 4) {
        l = mid + 1;
        continue;
      }
      bool g = false;
      if (comps == 1) {
        ans = min(ans, mid);
        r = mid - 1;
        continue;
      } else if (comps == 2) {
        for (long long int i = 0; i < (long long int)n; i++) {
          if (g) break;
          for (long long int j = i + 1; j < (long long int)n; j++) {
            if (g) break;
            if (label[i] == label[j]) continue;
            if (coor[i].first == coor[j].first &&
                abs(coor[i].second - coor[j].second) <= 2 * mid)
              g = true;
            if (coor[i].second == coor[j].second &&
                abs(coor[i].first - coor[j].first) <= 2 * mid)
              g = true;
            if (abs(coor[i].first - coor[j].first) <= mid &&
                abs(coor[i].second - coor[j].second) <= mid)
              g = true;
          }
        }
      } else if (comps == 3) {
        vector<pair<long long int, long long int>> seg;
        for (auto& it : x) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            seg.push_back({j, k});
          }
        }
        for (auto& it : y) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            seg.push_back({j, k});
          }
        }
        for (auto& it : seg) {
          long long int j = it.first, k = it.second;
          for (long long int i = 0; i < (long long int)n; i++) {
            if (g) break;
            if (label[i] == label[j] || label[i] == label[k]) continue;
            if (coor[j].first == coor[k].first) {
              long long int x1 = coor[j].first;
              long long int y1 = coor[i].second;
              bool ok = true;
              for (auto it : {coor[i], coor[j], coor[k]}) {
                if (abs(x1 - it.first) > mid || abs(y1 - it.second) > mid)
                  ok = false;
              }
              if (ok) g = true;
            } else {
              long long int x1 = coor[i].first;
              long long int y1 = coor[j].second;
              bool ok = true;
              for (auto it : {coor[i], coor[j], coor[k]}) {
                if (abs(x1 - it.first) > mid || abs(y1 - it.second) > mid)
                  ok = false;
              }
              if (ok) g = true;
            }
          }
        }
      } else {
        vector<pair<long long int, long long int>> segx, segy;
        for (auto& it : x) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            segx.push_back({j, k});
          }
        }
        for (auto& it : y) {
          vector<pair<long long int, long long int>>& vec = it.second;
          for (long long int i = 1; i < (long long int)vec.size(); i++) {
            long long int j = vec[i].second, k = vec[i - 1].second;
            if (label[j] == label[k]) continue;
            segy.push_back({j, k});
          }
        }
        for (long long int i = 0; i < (long long int)segx.size(); i++) {
          if (g) break;
          for (long long int j = 0; j < (long long int)segy.size(); j++) {
            if (label[segx[i].first] == label[segy[j].first] ||
                label[segx[i].first] == label[segy[j].second])
              continue;
            if (label[segx[i].second] == label[segy[j].first] ||
                label[segx[i].second] == label[segy[j].second])
              continue;
            if (g) break;
            long long int same_x = coor[segx[i].first].first;
            long long int same_y = coor[segy[j].first].second;
            bool ok = true;
            for (auto it : {coor[segx[i].first], coor[segx[i].second],
                            coor[segy[j].first], coor[segy[j].second]}) {
              if (abs(same_x - it.first) > mid || abs(same_y - it.second) > mid)
                ok = false;
            }
            if (ok) g = true;
          }
        }
      }
      if (g) {
        ans = min(ans, mid);
        r = mid - 1;
      } else
        l = mid + 1;
    }
    if (ans == INF32) ans = -1;
    cout << ans << '\n';
  }
  return 0;
}
