import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
/**
* phương thức kiểm tra số nguyên tố, nếu đúng trả về true, nếu sai trả về false
* @param x
* @return
*/
public static boolean testPrime(int x)
{
if(x==1||x==2)
return true;
else
{
for(int i=2;i<x;i++)
if((x%i)==0)
return false;
return true;
}
}
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new FileReader("input.txt"));
String k;
int l=0;
while((k=in.readLine())!=null)
{
if(l!=0)
{
//*********
String item[] = k.split(" ");
for(int j=Integer.parseInt(item[0]); j<=Integer.parseInt(item[1]); j++)
if(testPrime(j))
System.out.println(j);
//*********
System.out.println();
}
else
l++;
}
}
}