#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
template<class T> void chmax(T& a, T b){
    if(a < b){
        a = b;

    }
}
template<class T> bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
int main()
{
    int n;
    cin >> n;

    vector<int>a(n);
    vector<int>b(n);

    rep(i,n)cin >> a[i] >> b[i];

    const int inf = 1e6;

    int ans = inf;
    rep(i,n){
        rep(j,n){
            int time;
            if(i == j)time = a[i] + b[i];
            else{
                time = max(a[i],b[j]);
            }

            chmin(ans,time);
        }
    }


    cout << ans << endl;
    
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int solve(int a) {
  return a;
}

int main() {
  int N;
  int A[1010];
  int B[1010];
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  
  int ia = 0;
  int ib = 0;
  int ib_second = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] < A[ia]) {
      ia = i;
    }
    if (B[i] < B[ib]) {
      ib_second = ib;
      ib = i;
    }
  }
  
  
  if (ia == ib) {
    cout << min( A[ia] + B[ib], max(A[ia], B[ib_second]) ) << endl;
  } else if(ia == ib_second) {
    cout << min( max(A[ia], B[ib]), A[ia] + B[ib_second] ) << endl;
  } else {
    cout << min( max(A[ia], B[ib]), max(A[ia], B[ib_second]) ) << endl;
  }
}