#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll x[200005], y[200005];
pll tx[200005], ty[200005];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll n; cin >> n;
	for (ll i = 1; i <= n; i++){
		cin >> x[i] >> y[i];
		tx[i] = mp(x[i], i);
		ty[i] = mp(y[i], i);
	}
	sort(tx + 1, tx + n + 1);
	sort(ty + 1, ty + n + 1);
	ll ans = 0;
	if (tx[n].fi - tx[1].fi < ty[n].fi - ty[1].fi){
		for (ll i = 1; i <= n; i++){
			swap(x[i], y[i]);
			swap(tx[i], ty[i]);
		}
	}
	ans = max(ans, tx[n - 1].fi - tx[1].fi);
	ans = max(ans, tx[n].fi - tx[2].fi);
	ll id[4];
	id[0] = tx[1].se, id[1] = tx[n].se;
	if (id[0] > id[1]) swap(id[0], id[1]);
	id[2] = ty[1].se, id[3] = ty[n].se;
	if (id[2] > id[3]) swap(id[2], id[3]);
	bool c = 1;
	if ((id[0] == id[2]) && (id[1] == id[3])) c = 0;
	if (c) ans = max(ans, ty[n].fi - ty[1].fi);
	ans = max(ans, ty[n - 1].fi - ty[1].fi);
	ans = max(ans, ty[n].fi - ty[2].fi);
	cout << ans << "\n";
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned int
#define test int t;cin>>t; while(t--)
#define en '\n'
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) (int)x.size()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
// You should only debug a pair of simple data types. For example,
// the debug won't work if one of pair's elements is collection type
// (std::vector, std::map, std::set...).
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void print(T t, V... v) {_print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


// bool check_prime(int n)  return whether a number is prime or not O(sqrt(N));
// int BE(int x,int n,int m)  return x^n%m; O(logN);
// void sieve()  from number 1-1000001 saare prime store kar lega  in bool is_prime[1000001] array
// vector<int> z_array(string s)  return vector which is Z-array of string s;
// vector<int> lps(string s)      return vector which is lps array of string s;
// int power(int x,int n) return x^n; O(logN);
// using_ordered_set (template for using ordered set , replace first 2 lines of this page with this code..);
const int gf = 1e6 + 9;

int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  if (fopen("input.txt", "r"))
  {
    freopen ("input.txt" , "r" , stdin);
    freopen ("output.txt" , "w" , stdout);
  }
#endif
  //__________-code starts-________________

  int n;
  cin >> n;
  int x[n], y[n];
  vii v1, v2;

  zip(i, 0, n) {
    cin >> x[i] >> y[i];
    v1.pb({x[i], i});
    v2.pb({y[i], i});
  }
  sort(all(v1));
  sort(all(v2));
  set<pair<int, pii>>s;
  s.insert({v1[n - 1].ff - v1[0].ff, {min(v1[n - 1].ss, v1[0].ss), max(v1[n - 1].ss, v1[0].ss)}});
  s.insert({v1[n - 1].ff - v1[1].ff, {min(v1[n - 1].ss, v1[1].ss), max(v1[n - 1].ss, v1[1].ss)}});
  s.insert({v1[n - 2].ff - v1[0].ff, {min(v1[n - 2].ss, v1[0].ss), max(v1[n - 2].ss, v1[0].ss)}});
  s.insert({v2[n - 1].ff - v2[0].ff, {min(v2[n - 1].ss, v2[0].ss), max(v2[n - 1].ss, v2[0].ss)}});
  s.insert({v2[n - 1].ff - v2[1].ff, {min(v2[n - 1].ss, v2[1].ss), max(v2[n - 1].ss, v2[1].ss)}});
  s.insert({v2[n - 2].ff - v2[0].ff, {min(v2[n - 2].ss, v2[0].ss), max(v2[n - 2].ss, v2[0].ss)}});
  auto var = *s.rbegin();
  s.erase(s.find(var));
  cout << (*s.rbegin()).ff << en;




  return 0;
}