// asharusmani #include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; if(!(cin>>T)) return 0; while(T--){ ll N,K; cin>>N>>K; if(N > K*K){ cout< K; --x){ bool ok = true; ll r = floor(sqrt((long double)x)); for(ll d = 1; d <= r; ++d){ if(x % d) continue; ll e = x/d; if(d <= K && e <= K){ ok = false; break; } } if(ok){ ans = x; break; } } cout<