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

typedef long long ll;
typedef unsigned long long ull;
const double pi = acos(-1);
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const ull base = 131;
const ull mod1 = 1e9 + 9;
const ull mod2 = 1610612741;


const int maxn = 1e5 + 10;
int a[maxn], b[maxn], n;

int main()
{
    cin >> n;
    int ans = INT32_MAX;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i] >> b[i];
        ans = min(a[i]+b[i], ans);
    }
    for (int i = 1; i <= n; ++i)
        for (int j = i+1; j <= n; ++j)
            ans = min(ans, min(max(a[i], b[j]), max(a[j], b[i])));
    cout << ans;
    return 0;
}
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
//typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
//define
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

int main(){
    int n;
    cin >> n;
    vector<ll> a(n),b(n);
    rep(i,n) cin >> a.at(i) >> b.at(i);
    ll x=1e6,y=1e6;
    rep(i,n){
        rep(j,n){
            if(i==j){
                x=min(x,a.at(i)+b.at(j));
            }else{
                x=min(x,max(a.at(i),b.at(j)));
            }
        }
    }
    
    cout << x << endl;
}