#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i = 0; i < (n); i++)
using ll = long long;
using P = pair<ll, ll>;
template<class T> 
bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}
template<class T> 
bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}
// struct Edge { ll to; ll cost; Edge(ll t, ll c) { to = t; cost = c;} };
// using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<ll>>;
// priority_queue<P, vector<P>, greater<P>> q;

int main() {
    ll n; cin >> n;
    ll ans = 10010010010;
    vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    for (ll i = 0; i < n; i++) {
        for (ll j = 0; j < n; j++) {
            if (i == j) ans = min(ans, a[i] + b[i]);
            else {
                ans = min(ans, max(a[i], b[j]));
            }
        }
    }
    cout << ans << endl;
} 
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a,b; cin >> a >> b;
	if(b>a) 
	{
	    int sum=0;
	    int val=-1;
	    for(int i=0;i<b;i++) 
	    {
	        cout << val << " ";
	        sum += val;
	        val -= 1;
	    }
	    int val2=1;
	    for(int i=0;i<a-1;i++) 
	    {
	        cout << val2 << " ";
	        sum += val2;
	        val2 += 1;
	    }
	    cout << abs(sum);
	}
	else
	{
	    int sum=0;
	    int val=1;
	    for(int i=0;i<a;i++) 
	    {
	        cout << val << " ";
	        sum += val;
	        val += 1;
	    }
	    int val2=-1;
	    for(int i=0;i<b-1;i++) 
	    {
	        cout << val2 << " ";
	        sum += val2;
	        val2 -= 1;
	    }
	    cout << -1*sum;
	}
	return 0;
}