#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define MOD1 998244353
#define ceil(x, y) ((x)%(y))==0? ((x)/(y)) : ((x)/(y)+1)
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("in7.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    int T=1;
    // cin >> T;
    FOR1(tt, T){
        // cout << "Case #" << tt << ": ";
        int m, h; cin >> m >> h;
        if(h % m == 0) cout << "Yes";
        else cout << "No";

        cout << '\n';
    }
    return 0;
}
//a solutjion from @tanmaymodi
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ff(i,a,b) for(ll i=a;i<=b;i++)
#define bf(i,a,b) for(ll i=a;i>=b;i--)
const ll INF = 1e18;

//_______________necessary functinos____________
//________________DO NOT REMOVE_________________
ll ADD(ll x, ll y) {
	ll res = x + y;
	return (res >= mod ? res - mod : res);
}
ll MUL(ll x, ll y) {
	ll res = x * y;
	return (res >= mod ? res % mod : res);
}
ll SUB(ll x, ll y) {
	ll res = x - y;
	return (res < 0 ? res + mod : res);
}

ll POWER(ll x, ll y) {
	ll res = 1;
	x %= mod;
	while (y) {
		if (y & 1)
			res = MUL(res, x);
		y >>= 1; x = MUL(x, x);
	} return res;
}
ll MOD_INV(ll x) {
	return POWER(x, mod - 2);
}
ll maxofarray(ll a[], ll n) {
	ll max = a[0];
	ff(i, 0, n - 1) {
		if (max < a[i])
			max = a[i];
	}
	return max;
}


string lleger_to_binary_str(ll n) {
	string s = "";
	while (n > 0) {
		if (n % 2 == 0) {
			s += "0";
		}
		else {
			s += "1";
		}
		n /= 2;
	}
	reverse(s.begin(), s.end());
	return s;
}
//_______________________________________
void solve() {
	ll n;
	cin >> n;
	ll ans = mod;
	vector<ll> x(n), y(n);
	ff(i, 0, n - 1) {
		cin >> x[i] >> y[i];
	}
	ff(i, 0, n - 1) {
		ff(j, 0, n - 1) {
			if (i == j) {
				ans = min(ans, x[i] + y[j]);
			} else {
				ans = min(ans, max(x[i], y[j]));
			}
		}
	}
	cout << ans << endl;
}
//_______________________________________

int main() {
	//________________________________________
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//_______________________________________



	solve();

}