#include<bits/stdc++.h>
#define ll long long
using namespace std;
vectorp;
const int limit=pow(10,4.5);
void sieve()
{
bool prime[limit+1];
memset(prime,true,sizeof(prime));
for(ll i=2;i<=limit;i++)
{
\
if(prime[i])
{
p.push_back(i);
for(ll j=i*i;j<=limit;j+=i)
prime[j]=false;
}
}
}
void prime_ab(ll m,ll n)
{
bool mark[100001];
memset(mark,true,sizeof(mark));
for(int i=0;p[i]<=sqrt(n) && i< p.size();i++)
{
for(ll j=m;j<=n;j++)
{
if(j%p[i]==0)
{mark[j-m]=false;//multiples of prime seive are false in m to n
}
}
}
for(ll i=m;i<=n;i++)
{
if(mark[i-m])
cout<<i<<endl;
}
}
int main()
{
int T;
ll m,n;
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>T;
sieve();
while(T–)
{
cin>>m>>n;
prime_ab(m,n);cout<<endl;
}
return 0;}
TESTCASE # 1 : wrong-answer (Time: 0.1 s)
TESTCASE # 2 : wrong-answer (Time: 4.7 s)
TESTCASE # 3 : correct (Time: 0.12 s)
TESTCASE # 4 : correct (Time: 0 s)
TESTCASE # 5 : wrong-answer (Time: 0.23 s)
TESTCASE # 6 : wrong-answer (Time: 0.08 s)
TESTCASE # 7 : timelimit (Time: 5.91 s)