#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<iomanip>
#include<queue>
#include<cmath>
#include<stack>
#include<map> 
#define ll                   long long
#define skip                 cin>>ws;
#define vll                  vector<ll> 
#define vb                   vector<bool>
#define vpll                 vector<pair<ll,ll>>
#define vi                   vector<int>
#define vpi                  vector<pair<int, int>>
#define vvll                 vector<vector<ll>>
#define vvi                  vector<vector<int>>
#define vvvll                vector<vector<vector<ll>>>
#define pll                  pair<ll,ll>
#define vs                   vector<string>
#define vvpll                vector<vector<pair<ll, ll>>>
#define vvpi                 vector<vector<pair<int, int>>>
#define pb                   push_back
#define pob                  pop_back()
#define MOD                  (ll)(1e9 + 7)
#define MOD2                 (ll)(998244353)
#define INF                  (ll)(1e18 + 5)
#define count1(n)            __builtin_popcountll(n)
#define test                 ll t; cin>>t; while(t--)
#define all(x)               begin(x), end(x)

using namespace std;

void inline show(vll &a){for(ll e: a){if(e == INF) cout<<"INF ";else cout<<e<<" ";}cout<<"\n";}

template<typename T> void enter(vector<T> &a){ for(T &e: a) cin>>e; } 

ll inline mo(ll a){ return a%MOD;}

ll inline po(ll x, ll y, ll p)
{
    ll res = 1; x = x % p;   
    while (y > 0) { if (y & 1) res = (res * x) % p; y >>= 1; x = (x * x) % p; } 
    return res%p; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin>>n;

    vector<pair<pll, ll>> a(n), ma;
    for(ll i=0;i<n;i++)
    {
        ll x ,y;
        cin>>x>>y;
        a[i] = {{x, y}, i};
    }

    sort(all(a));

    ma.pb({
        {min(a[0].second, a[n-1].second), max(a[0].second, a[n-1].second)}
        , a[n - 1].first.first - a[0].first.first});

    ma.pb({
        {min(a[0].second, a[n-2].second), max(a[0].second, a[n-2].second)}
        , a[n - 2].first.first - a[0].first.first});

    ma.pb({
        {min(a[1].second, a[n-1].second), max(a[1].second, a[n-1].second)}
        , a[n - 1].first.first - a[1].first.first});

    sort(all(a), [&](pair<pll, ll> a, pair<pll, ll> b){
        return a.first.second < b.first.second;
    });

    ma.pb({
        {min(a[0].second, a[n-1].second), max(a[0].second, a[n-1].second)}
        , a[n - 1].first.second - a[0].first.second});

    ma.pb({
        {min(a[0].second, a[n-2].second), max(a[0].second, a[n-2].second)}
        , a[n - 2].first.second - a[0].first.second});

    ma.pb({
        {min(a[1].second, a[n-1].second), max(a[1].second, a[n-1].second)}
        , a[n - 1].first.second - a[1].first.second});

    sort(all(ma), [&](pair<pll, ll> a, pair<pll, ll> b){
        return a.second > b.second;
    });

    for(ll i=1;i<ma.size();i++)
    {
        if(ma[i].first != ma[i - 1].first)
        {
            cout<<ma[i].second<<"\n";
            return 0;
        }
    }

    return 0;
}   

#pragma GCC optimize(3)
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <queue>
#include <algorithm>
#define maxn 200010
using namespace std;
int read()
{
	int x=0,w=1;
	char ch=getchar();
	while((ch>'9'||ch<'0')&&(ch!='-')) ch=getchar();
	if(ch=='-')
	{
		w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return x*w;
}
int n;
struct Code
{
	int l,r,num;
}code[maxn];
struct Heap
{
	int l,r,num;
}heap[maxn];
priority_queue <int> q;
int ans,res;
bool cmpl(Code x,Code y)
{
	return x.l<y.l;
}
bool cmpr(Heap x,Heap y)
{
	return x.r<y.r;
}
int main()
{
	n=read();
	for(register int i=1;i<=n;i++)
	{
		code[i].l=read();
		code[i].r=read();
		code[i].num=i;
		heap[i].l=code[i].l;
		heap[i].r=code[i].r;
		heap[i].num=i;
	}
	sort(code+1,code+n+1,cmpl);
	sort(heap+1,heap+n+1,cmpr);
	if(code[n].l-code[1].l>code[n].r-code[1].r) q.push(code[n].l-code[1].l);
	if(code[n-1].l-code[1].l>code[n-1].r-code[1].r) q.push(code[n-1].l-code[1].l);
	if(code[n].l-code[2].l>code[n].r-code[2].r) q.push(code[n].l-code[2].l);
	if(heap[n].r-heap[1].r>=heap[n].l-heap[1].l) q.push(heap[n].r-heap[1].r);
	if(heap[n-1].r-heap[1].r>=heap[n-1].l-heap[1].l) q.push(heap[n-1].r-heap[1].r);
	if(heap[n].r-heap[2].r>=heap[n].l-heap[2].l) q.push(heap[n].r-heap[2].r);
	q.pop();
	cout<<q.top();
    return 0;
} 