#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(c) (c).begin(), (c).end()

void solve() {
    int N;
    cin >> N;
    
    vector <pair <int, int> > time(N);
    for (auto &el : time) cin >> el.first >> el.second;

    int ans = INT_MAX;

    for (int i = 0; i < N; i++) {
        ans = min(ans, time[i].first + time[i].second);
    }

    sort(all(time));

    int x = INT_MAX;
    for (int i = 1; i < N; i++) {
        x = min(x, time[i].second);
    }

    ans = min(ans, max(time[0].first, x));

    sort(all(time), [] (const pair <int, int> &A, const pair <int, int> &B) {
        return A.second < B.second;
    });

    x = INT_MAX;

    for (int i = 1; i < N; i++) {
        x = min(x, time[i].first);
    }

    ans = min(ans, max(time[0].second, x));
    
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
    cout << '\n';
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a=100000;
  int b=100000;
  int aa=0;
  int N=0;
  int ans=0;
  cin>>N;
  vector<int>A(N),B(N);
  for(int i=0; i<N; i++){
    cin>>A.at(i)>>B.at(i);
  }
  for(int i=0; i<N; i++){
    if(A.at(i)<a){
      a=A.at(i);
      aa=i;
    }
  }
  for(int j=0; j<N; j++){
    if(j==aa){
      continue;
    }
    else if(B.at(j)<b){
      b=B.at(j);
    }
  }
  if(a>b){
    ans=a;
  }
  else{
    ans=b;
  }
  if(A.at(aa)+B.at(aa)>=ans){
    cout<<ans<<endl;
  }
  else {
    cout<<A.at(aa)+B.at(aa)<<endl;
  }
  
}