// #pragma GCC optimize("O3,unroll-loops") #include // #include using namespace std; #if __cplusplus >= 202002L using namespace numbers; #endif template T &ctmin(T &x){ return x; } template T &ctmin(T &x, const Head &h, const Tail &... t){ return ctmin(x = min(x, h), t...); } template T &ctmax(T &x){ return x; } template T &ctmax(T &x, const Head &h, const Tail &... t){ return ctmax(x = max(x, h), t...); } int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n; cin >> n; vector> div(200'001); for(auto x = 1; x <= 200'000; ++ x){ for(auto y = x; y <= 200'000; y += x){ div[y].push_back(x); } } vector> a(n); for(auto &[x, y]: a){ cin >> x >> y; } int res = -1; { ranges::sort(a); vector> b; for(auto l = 0; l < n; ){ int r = l; while(r < n && a[l][0] == a[r][0]){ ++ r; } if(r - l >= 2){ ctmax(res, a[r - 2][1]); } b.push_back(a[r - 1]); l = r; } a = b; } ranges::sort(a, [&](auto p, auto q){ return 1LL * p[0] * p[1] > 1LL * q[0] * q[1]; }); vector opt(200'001, numeric_limits::max()); for(auto [x, y]: a){ for(auto g: div[x]){ ctmax(res, y / opt[g]); } for(auto g: div[x]){ ctmin(opt[g], x / g); } } cout << res << "\n"; return 0; } /* */