This is my solution, I’ve been tweaking this as much as I could, I still doing know where I’m going wrong.

```
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
long long int n,m;
while(t--)
{
cin>>m>>n;
if(m%2==0)
++m;
for(;m<=n;m+=2)
{
if(m<9)
{
if(m==3 || m==5 || m==7 || m==1)
{
if(m==1)
cout<<2<<"\n";
else
cout<<m<<"\n";
}
continue;
}
long int k=3;
while(k<=sqrt(m) && m%k!=0)
k+=2;
if(k>sqrt(m))
cout<<m<<"\n";
}
cout<<"\n";
}
}
```