#include using namespace std; int main() { long long L, H; cin >> L >> H; const int N = 2e5 + 100; vector primes; vector is_prime(N, true); for (int i = 2; i < N; i++) { if (is_prime[i]) { primes.push_back(i); for (int j = i * 2; j < N; j += i) { is_prime[j] = false; } } } if (H - L <= 200200) { pair ans; for (long long i = L; i <= H; i++) { long long p = 1; for (int j = 0; j < primes.size(); j++) { if (i % primes[j] == 0) { if (i != primes[j]) p = primes[j]; break; } } if (p != 1) ans = max(ans, make_pair(p, i)); } cout << ans.second << endl; return 0; } for (int i = primes.size() - 1; i >= 0; i--) { long long cand = primes[i] * primes[i]; if (L <= cand && cand <= H) { cout << cand << endl; return 0; } } cout << "fail" << endl; }