#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'

// n acho que eu seja bom, mas eu ja fui pior

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int oo = 1e9;
const ll OO = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, a, b, ans = oo, menor = oo, maior = -oo; cin >> n;
    vector<pii> ta, tb;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        
        ans = min(ans, a+b);
        
        ta.push_back({a, i});
        tb.push_back({b, i});
    }
    
    sort(ta.begin(), ta.end());
    sort(tb.begin(), tb.end());
    
    int it = 0;
    while (it < n) {
        if (tb[it].ss != ta[0].ss) {
            ans = min(ans, max(tb[it].ff, ta[0].ff));
            break;
        }
        
        it++;
    }
    
    it = 0;
    while (it < n) {
        if (tb[0].ss != ta[it].ss) {
            ans = min(ans, max(tb[0].ff, ta[it].ff));
            break;
        }
        
        it++;
    }
    
    cout << ans << endl;
    
    return 0;
}
#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define F first
#define S second

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n;cin>>n;
  vector<ll>a(n), b(n);
  rep(i, n)cin>>a[i]>>b[i];

  ll r = INF;
  rep(i, n)rep(j, n){
    if(i==j)r = min<ll>(r, a[i]+b[j]);
    else r = min<ll>(r, max<ll>(a[i], b[j]));
//cout<<i<<' '<<j<<' '<<r<<endl;
  }

  cout<<r<<endl;

  return 0;
}
