#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9 + 1;
int n;
vector<vector<int>> g;
vector<int> vis;
void dfs(int cur, int now) {
  vis[cur] = now;
  for (auto &x : g[cur]) {
    if (!vis[x]) dfs(x, now);
  }
}
int main() {
  scanf("%d", &n);
  vector<int> x(n);
  vector<int> y(n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
  }
  unordered_map<int, vector<pair<int, int>>> same_x, same_y;
  for (int i = 0; i < n; i++) {
    same_x[x[i]].push_back(make_pair(y[i], i));
    same_y[y[i]].push_back(make_pair(x[i], i));
  }
  for (auto &c : same_x) {
    sort(c.second.begin(), c.second.end());
  }
  for (auto &c : same_y) {
    sort(c.second.begin(), c.second.end());
  }
  long long lb = -1, rb = inf;
  while (rb - lb > 1) {
    long long mid = (lb + rb) / 2;
    g.clear();
    g.resize(n);
    for (auto &c : same_x) {
      for (int i = 1; i < (int)c.second.size(); i++) {
        if (c.second[i].first - c.second[i - 1].first <= mid) {
          g[c.second[i].second].push_back(c.second[i - 1].second);
          g[c.second[i - 1].second].push_back(c.second[i].second);
        }
      }
    }
    for (auto &c : same_y) {
      for (int i = 1; i < (int)c.second.size(); i++) {
        if (c.second[i].first - c.second[i - 1].first <= mid) {
          g[c.second[i].second].push_back(c.second[i - 1].second);
          g[c.second[i - 1].second].push_back(c.second[i].second);
        }
      }
    }
    int now = 0;
    vis.assign(n, 0);
    for (int i = 0; i < n; i++) {
      if (!vis[i]) {
        now++;
        dfs(i, now);
      }
    }
    bool flag = false;
    if (now == 1) {
      rb = mid;
      continue;
    } else if (now == 2) {
      for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
          if (vis[i] == vis[j]) continue;
          if (x[i] == x[j] && abs(y[i] - y[j]) <= 2 * mid) flag = true;
          if (y[i] == y[j] && abs(x[i] - x[j]) <= 2 * mid) flag = true;
          if (abs(x[i] - x[j]) <= mid && abs(y[i] - y[j]) <= mid) flag = true;
        }
      }
    } else if (now == 3) {
      vector<pair<int, int>> seg;
      for (auto &c : same_x) {
        for (int i = 1; i < (int)c.second.size(); i++) {
          if (vis[c.second[i].second] != vis[c.second[i - 1].second]) {
            seg.push_back(
                make_pair(c.second[i].second, c.second[i - 1].second));
          }
        }
      }
      for (auto &c : same_y) {
        for (int i = 1; i < (int)c.second.size(); i++) {
          if (vis[c.second[i].second] != vis[c.second[i - 1].second]) {
            seg.push_back(
                make_pair(c.second[i].second, c.second[i - 1].second));
          }
        }
      }
      for (auto &c : seg) {
        int x1 = c.first;
        int x2 = c.second;
        for (int i = 0; i < n; i++) {
          if (vis[x1] == vis[i] || vis[x2] == vis[i]) continue;
          if (x[x1] == x[x2]) {
            if (abs(x[i] - x[x1]) <= mid && abs(y[i] - y[x1]) <= mid &&
                abs(y[i] - y[x2]) <= mid)
              flag = true;
          } else {
            if (abs(y[i] - y[x1]) <= mid && abs(x[i] - x[x1]) <= mid &&
                abs(x[i] - x[x2]) <= mid)
              flag = true;
          }
        }
      }
    } else if (now == 4) {
      vector<pair<int, int>> seg_x, seg_y;
      for (auto &c : same_x) {
        for (int i = 1; i < (int)c.second.size(); i++) {
          if (vis[c.second[i].second] != vis[c.second[i - 1].second]) {
            seg_x.push_back(
                make_pair(c.second[i].second, c.second[i - 1].second));
          }
        }
      }
      for (auto &c : same_y) {
        for (int i = 1; i < (int)c.second.size(); i++) {
          if (vis[c.second[i].second] != vis[c.second[i - 1].second]) {
            seg_y.push_back(
                make_pair(c.second[i].second, c.second[i - 1].second));
          }
        }
      }
      for (auto &cx : seg_x) {
        for (auto &cy : seg_y) {
          int x1 = cx.first;
          int x2 = cx.second;
          int y1 = cy.first;
          int y2 = cy.second;
          if (vis[x1] == vis[y1] || vis[x1] == vis[y2] || vis[x2] == vis[y1] ||
              vis[x2] == vis[y2])
            continue;
          int xx = x[x1];
          int yy = y[y1];
          if (abs(y[x1] - yy) <= mid && abs(y[x2] - yy) <= mid &&
              abs(x[y1] - xx) <= mid && abs(x[y2] - xx) <= mid)
            flag = true;
        }
      }
    } else {
      lb = mid;
      continue;
    }
    if (flag) {
      rb = mid;
    } else {
      lb = mid;
    }
  }
  if (rb == inf)
    cout << -1;
  else
    cout << rb;
  return 0;
}
