#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  static char c;
  int f = 0;
  while (!isdigit(c = getchar()))
    if (c == '-') f = 1;
  x = c ^ 48;
  while (isdigit(c = getchar())) x = (x * 10) + (c ^ 48);
  if (f) x = -x;
}
void read(long long &x) {
  static char c;
  int f = 0;
  while (!isdigit(c = getchar()))
    if (c == '-') f = 1;
  x = c ^ 48;
  while (isdigit(c = getchar())) x = (x * 10) + (c ^ 48);
}
void read(unsigned int &x) {
  static char c;
  while (!isdigit(c = getchar()))
    ;
  x = c ^ 48;
  while (isdigit(c = getchar())) x = (x * 10) + (c ^ 48);
}
void read(unsigned long long &x) {
  static char c;
  while (!isdigit(c = getchar()))
    ;
  x = c ^ 48;
  while (isdigit(c = getchar())) x = (x * 10) + (c ^ 48);
}
void chkmax(int &x, int y) {
  if (y > x) x = y;
}
void chkmin(int &x, int y) {
  if (y < x) x = y;
}
void chkmax(long long &x, long long y) {
  if (y > x) x = y;
}
void chkmin(long long &x, long long y) {
  if (y < x) x = y;
}
void chkmax(unsigned int &x, unsigned int y) {
  if (y > x) x = y;
}
void chkmin(unsigned int &x, unsigned int y) {
  if (y < x) x = y;
}
void chkmax(unsigned long long &x, unsigned long long y) {
  if (y > x) x = y;
}
void chkmin(unsigned long long &x, unsigned long long y) {
  if (y < x) x = y;
}
const int N = 1e3 + 10;
int n;
struct Point {
  int x, y, id;
} A[N], B[N], C[N];
bool Bas_x(Point lhs, Point rhs) {
  return lhs.x < rhs.x || ((lhs.x == rhs.x && lhs.y < rhs.y));
}
bool Bas_y(Point lhs, Point rhs) {
  return lhs.y < rhs.y || ((lhs.y == rhs.y && lhs.x < rhs.x));
}
int fa[N];
void Init() {
  for (int i = 1; i <= n; ++i) fa[i] = i;
}
int getf(int now) { return now == fa[now] ? now : fa[now] = getf(fa[now]); }
void Merge(int u, int v) {
  int Fu = getf(u), Fv = getf(v);
  if (Fu != Fv) fa[Fu] = Fv;
}
bool chk(int mid) {
  Init();
  for (int i = 1; i < n; ++i)
    if (A[i].x == A[i + 1].x && A[i + 1].y - A[i].y <= mid)
      Merge(A[i].id, A[i + 1].id);
  for (int i = 1; i < n; ++i)
    if (B[i].y == B[i + 1].y && B[i + 1].x - B[i].x <= mid)
      Merge(B[i].id, B[i + 1].id);
  int cnt = 0;
  for (int i = 1; i <= n; ++i) cnt += (fa[i] == i);
  if (cnt > 4) return false;
  if (cnt == 1) return true;
  if (cnt == 2) {
    auto Jud = [](int i, int j, int mid) -> bool {
      if (C[i].x == C[j].x)
        if (abs(C[i].y - C[j].y) <= 2 * mid)
          return true;
        else
          return false;
      if (C[i].y == C[j].y)
        if (abs(C[i].x - C[j].x) <= 2 * mid)
          return true;
        else
          return false;
      if (max(abs(C[i].x - C[j].x), abs(C[i].y - C[j].y)) <= mid)
        return true;
      else
        return false;
    };
    for (int i = 1; i < n; ++i)
      for (int j = i + 1; j <= n; ++j)
        if (getf(i) ^ getf(j))
          if (Jud(i, j, mid)) return true;
    return false;
  }
  if (cnt == 3) {
    for (int i = 1; i < n; ++i) {
      int u = A[i].id, v = A[i + 1].id;
      int Fu = getf(u), Fv = getf(v);
      if (Fu == Fv || A[i].x ^ A[i + 1].x) continue;
      for (int j = 1; j <= n; ++j) {
        int Fj = getf(j);
        if (Fj == Fu || Fj == Fv) continue;
        if (max(abs(C[j].x - A[i].x),
                max(abs(A[i].y - C[j].y), abs(A[i + 1].y - C[j].y))) <= mid)
          return true;
      }
    }
    for (int i = 1; i < n; ++i) {
      int u = B[i].id, v = B[i + 1].id;
      int Fu = getf(u), Fv = getf(v);
      if (Fu == Fv || B[i].y ^ B[i + 1].y) continue;
      for (int j = 1; j <= n; ++j) {
        int Fj = getf(j);
        if (Fj == Fu || Fj == Fv) continue;
        if (max(abs(C[j].y - B[i].y),
                max(abs(B[i].x - C[j].x), abs(B[i + 1].x - C[j].x))) <= mid)
          return true;
      }
    }
    return false;
  }
  if (cnt == 4) {
    for (int i = 1; i < n; ++i) {
      if (A[i].x != A[i + 1].x) continue;
      int L = A[i].id, R = A[i + 1].id;
      int FL = getf(L), FR = getf(R);
      if (FL == FR) continue;
      for (int j = 1; j < n; ++j) {
        if (B[j].y != B[j + 1].y) continue;
        int D = B[j].id, U = B[j + 1].id;
        int FD = getf(D), FU = getf(U);
        if (FD == FU) continue;
        if (FD == FL || FD == FR || FU == FL || FU == FR) continue;
        if (max(max(abs(A[i].x - B[j].x), abs(A[i].x - B[j + 1].x)),
                max(abs(B[j].y - A[i].y), abs(B[j].y - A[i + 1].y))) <= mid)
          return true;
      }
    }
    return false;
  }
}
void Work() {
  read(n);
  for (int i = 1; i <= n; ++i)
    read(A[i].x), read(A[i].y), A[i].id = i, B[i] = C[i] = A[i];
  sort(A + 1, A + n + 1, Bas_x), sort(B + 1, B + n + 1, Bas_y);
  long long l = 0, r = 2e9, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (chk(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%lld\n", ans);
}
int main() { Work(); }
