#include <bits/stdc++.h>
using namespace std;

int main() {
	long long n,i,ans1,ans2,ans3,ans4,ans5;
	cin >> n;
	vector<pair<long long,long long>> x(n),y(n);
	for(i=0; i<n; i++){
		cin >> x[i].first >> x[i].second;
		y[i].first=x[i].second; y[i].first=x[i].second;
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	ans1=x[n-1].first-x[0].first;
	ans2=max(x[n-1].first-x[1].first,x[n-2].first-x[0].first);
	ans3=y[n-1].first-y[0].first;
	ans4=max(y[n-1].first-y[1].first,y[n-2].first-y[0].first);
	ans5=abs(x[n-1].second-x[0].second);
	if(ans5==ans3){
		cout << max(ans2,ans4) << endl;
	}else{
		vector<long long> ans(4);
		ans[0]=ans1; ans[1]=ans2; ans[2]=ans3,ans[3]=ans4;
		sort(ans.begin(),ans.end());
		cout << ans[2] << endl;
	}
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

void solve() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    for(auto& e : s) {
        if(e == '6') {
            e = '9';
        } else if(e == '9') {
            e = '6';
        }
    }    
    cout << s << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
