package com.teamtreehouse;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int testCases = in.nextInt();
int k = 0;
while (k < testCases) {
int num1 = in.nextInt();
int num2 = in.nextInt();
// loop through the numbers one by one
for (int i = num1; i <= num2; i++) {
boolean isPrimeNumber = true;
// check to see if the number is prime
if (i == 1)
isPrimeNumber = false;
for (int j = 2; j < i; j++) {
if (i % j == 0) {
isPrimeNumber = false;
break; // exit the inner for loop
}
}
if (isPrimeNumber){ System.out.format("%d ", i);}
}
System.out.println();
k++;
}
}
}