#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vint A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    ll ans = LINF;
    rep(i, N) {
        ans = min(ans, ll(A[i]) + ll(B[i]));
    }

    rep(i, N) {
        rep(j, N) {
            if (i == j) continue;
            ans = min(ans, ll(max(A[i], B[j])));
        }
    }

    
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const int inf = 1 << 29;
const ll infll = 1LL << 60;
const int mod = 1000000007;
const int mod9 = 998244353;

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

template<class T> bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    else return false;
}

int main(){
    int n; cin >> n;

    vector<int> a(n), b(n);
    int ans = inf;
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i];
        ans = min(ans, a[i]+b[i]);
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i != j){
                ans = min(ans, max(a[i], b[j]));
            }
        }
    }

    cout << ans << endl;

}
