///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           nd(a,b,c)                   mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=2e18;
const int mod=1e9+7;
const int M=200005;
int n,x[M],y[M];
bool cmp1(int i,int j)
{
    if(x[i]==x[j])return y[i]<y[j];
    else return x[i]<x[j];
}
bool cmp2(int i,int j)
{
    if(y[i]==y[j])return x[i]<x[j];
    else return y[i]<y[j];
}
set< pair<int,pi> >s;
set< pair<int,pi> >::iterator it;
void work(int i,int j)
{
    int cost=max(abs(x[j]-x[i]),abs(y[j]-y[i]));
    if(i<j)s.insert({cost,{i,j}});
    else s.insert({cost,{j,i}});
}
void solve()
{
   cin>>n;
   vector<int>vec;
   f(i,1,n)
   {
       cin>>x[i]>>y[i];vec.pb(i);
   }
   sort(vec.begin(),vec.end(),cmp1);
   work(vec[0],vec[n-1]);
   work(vec[0],vec[n-2]);
   work(vec[1],vec[n-1]);

   sort(vec.begin(),vec.end(),cmp2);
   work(vec[0],vec[n-1]);
   work(vec[0],vec[n-2]);
   work(vec[1],vec[n-1]);

   it=s.end();
   it--;it--;
   cout<<it->fi<<endl;
}

 main()

{
    fast
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;

}




































#include <bits/stdc++.h>

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; ++i)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; --i)

template <typename Tp> void in(Tp &x) {
  char ch = getchar(), f = 1; x = 0;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}

template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}
template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}

LL n; int m;

int power(int x, LL y, int p) {
  int ret = 1; x %= p;
  while (y) {
    if (y & 1) ret = 1ll * ret * x % p;
    x = 1ll * x * x % p;
    y >>= 1;
  }
  return ret;
}

int main() {
  in(n); in(m);

  int t = power(10, n, m);
  int sb = (power(10, n, m * m) - t + m * m) % (m * m);
  
  printf("%d\n", (sb / m) % m);
  
  return 0;
}
