#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n;
  cin>>n;
  vector<pair<long long int,long long int>> hoge(n);
  for(long long int i=0;i<n;i++){
    cin>>hoge.at(i).first>>hoge.at(i).second;
  }
  long long int ans=9999999999999;
  for(long long int i=0;i<n;i++){
    for(long long int j=0;j<n;j++){
      long long int pre;
      if(i==j){
        pre=hoge.at(i).first+hoge.at(i).second;
      }else{
        pre=max(hoge.at(i).first,hoge.at(j).second);
      }
      ans=min(ans,pre);
    }
  }
  cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;


#define forr(i,n) for(int i = 0 ; i  < n ; i++)
#define forr1(i,n) for(int i = 1 ; i  <= n ; i++)
#define int long long int
#define pb push_back
#define endl "\n"

const int N = 2e7 + 5 ;
const int inf = 1e9 + 32;


int binary_search(vector<int> &v , int i)
{
    int l = 1 , r = v.size() , ans = 0 ;
    while ( r >= l)
    {
        int mid = (r + l ) / 2;
        cout << 1 << " " << v[mid - 1] << " " << i << "\n";
        cout.flush();
        int z ; cin >> z ;
        if (z != i)
        {
            l = mid + 1;
            ans = l;
        }
        else
        {

            r = mid - 1;
            // ans = mid ;
        }
    }

    return ans;
}
int get_val(int digit)
{
    for (int i = 0 ; i < 3 ; i++)
        digit = digit * 10 + 9;
    return digit;
}
bool mysort(pair<int, int> a , pair<int, int> b )
{
    return a.second < b.second ;
}
int32_t main()
{

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt" , "r" , stdin);
//     freopen("output.txt" , "w" , stdout);
// #endif


    int n ;
    cin >> n;
    vector<pair<int, int>> p(n);
    int total = INT_MAX , min_a = INT_MAX , min_b = INT_MAX ;
    int index_a = 0 , index_b = 0 ;
    forr(i, n)
    {
        cin >> p[i].first >> p[i].second;
        total = min(total , p[i].first + p[i].second);
        if (p[i].first < min_a)
        {
            min_a = min(min_a, p[i].first) ;
            index_a = i ;
        }
        if (p[i].second < min_b)
        {
            min_b = min(min_b , p[i].second);
            index_b = i ;
        }
    }
    int ans  ;
    if (index_b == index_a)
    {
        sort(p.begin() , p.end());
        int a2 = p[1].first;
        sort(p.begin() , p.end() , mysort);
        int a3 = p[1].second ;
        ans = min({ max(a2 , min_b) , max(a3 , min_a) , total});
    }
    else
    {
        ans = min(total , max(min_a , min_b));
    }


    cout << ans << endl;

}