#include<bits/stdc++.h>
using namespace std;
int a[1111],b[1111];
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		int ans = 111111111;
		for(int i =1 ; i <= n ; i++){
			scanf("%d %d",&a[i],&b[i]);
		}
		for(int i = 1; i <= n ; i++){
			for(int j = 1 ; j <= n ; j++)
				if(i == j){
					ans = min (ans, a[i]+b[j]);
				}else ans = min (ans, max(a[i],b[j]));
		}
		printf("%d\n",ans);
	}
	return 0;
}
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
  int n;
  cin >> n;
  int a[n], b[n];
  rep(i, n)
  {
    cin >> a[i] >> b[i];
  }
  int time[2] = {a[0], b[0]};
  int ans;
  rep(i, n)
  {
    rep(j, n)
    {
      if (i == j)
      {
        if (a[i] + b[i] <= max(time[0], time[1]))
        {
          time[0] = a[i];
          time[1] = b[j];
          ans = time[0] + time[1];
        }
      }
      else
      {
        if (max(a[i], b[j]) <= max(time[0], time[1]))
        {
          time[0] = a[i];
          time[1] = b[j];
          ans = max(time[0], time[1]);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
