#include using namespace std; struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init; typedef long long LL; vector prime; struct eratosthenes{ eratosthenes(){ vector used(200001,true); for(int i = 2; i*i <= 200000; i++){ if(used[i]){ for(int j = i+i; j <= 200000; j+=i)used[j]=false; } } for(int i = 2; i <= 200000; i++) if(used[i])prime.push_back(i); } }e; int main() { LL L,H; cin >> L >> H; LL b=0; for(; prime[b]*prime[b] <= H; b++); b--; L=max(L,prime[b]*prime[b]); pair res(0,0); for(LL i = L; i <= H; i++){ LL v=i; LL d=114514; for(int j = 0;prime[j]*prime[j]<=v; j++) while(v%prime[j]==0){ d=min(d,prime[j]); v/=prime[j]; } if(v==i)continue; res=max(res,make_pair((int)d,i)); } cout << res.second<