#include <bits/stdc++.h>
using namespace std;
struct zs{
int x,y;
};
zs a[105];
bool prime(int n){
if(n < 2) return false;
for(int i = 2; i * i <= n; i++){
if(n % i == 0){
return false;
}
}
return true;
}
int main(){
int s,x,y;
cin >> s;
for(int i = 0; i < s; i++){
cin >> a[i].x >> a[i].y;
for(int j = x; j <= y; j++){
if(prime(i)){
cout << i << endl;
}
cout << endl;
}
}
return 0;
}