#include<iostream>
using namespace std;
int main()
{
int b,m,n,i,k,j,flag,t,a=0;
cin>>t;
for(k=1;k<=t;k++)
{
cin>>m>>n;
if((m>=1)&&(m<=n)&&(n<=1000000000)&&(n-m<=100000))
for(i=m;i<=n;i++)
{
if(i==1)
continue;
flag=1;
for(j=2;j<=i/2;j++)
{
if(i%j==0)
{
flag=0;
break;
}
}
if(flag==1)
cout<<i<<endl;
}
cout<<endl;
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCkKewoJaW50IGIsbSxuLGksayxqLGZsYWcsdCxhPTA7CgljaW4+PnQ7Cglmb3Ioaz0xO2s8PXQ7aysrKQp7CgljaW4+Pm0+Pm47CgkgaWYoKG0+PTEpJiYobTw9bikmJihuPD0xMDAwMDAwMDAwKSYmKG4tbTw9MTAwMDAwKSkKCWZvcihpPW07aTw9bjtpKyspCgl7CgkJaWYoaT09MSkKCQljb250aW51ZTsKCQlmbGFnPTE7CgkJZm9yKGo9MjtqPD1pLzI7aisrKQoJCXsKCQkJCgkJCWlmKGklaj09MCkKCQkJewoJCQlmbGFnPTA7CgkJCWJyZWFrOwoJCX0KCQl9CgkJaWYoZmxhZz09MSkKCQljb3V0PDxpPDxlbmRsOwoJfQoJY291dDw8ZW5kbDsKfQpyZXR1cm4gMDsKfQ==