#include <iostream>
#include <math.h>
#include <deque>
#include <sstream>
bool is_prime(const int &number)
{
if (number < 2)
return false;
int j = sqrt(number);
for (int i = 2; i < j; i++)
if (number%i == 0)
return false;
return true;
}
int main()
{
std::deque<int> outputLimits;
int testsDone = 0;
int numTests;
std::cin >> numTests;
while (testsDone <= numTests)
{
// std::string test;
int first, second;
//getline(std::cin, test);
//std::stringstream ss(test);
std::cin >> first >> second;
outputLimits.push_back(first);
outputLimits.push_back(second);
++testsDone;
}
while (!outputLimits.empty())
{
int start = outputLimits[0];
int finish = outputLimits[1];
while (start <= finish)
{
if (is_prime(start))
std::cout << start << std::endl;
++start;
}
outputLimits.pop_front();
outputLimits.pop_front();
std::cout << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWF0aC5oPgojaW5jbHVkZSA8ZGVxdWU+CiNpbmNsdWRlIDxzc3RyZWFtPgoKYm9vbCBpc19wcmltZShjb25zdCBpbnQgJm51bWJlcikKewogICAgaWYgKG51bWJlciA8IDIpCiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIAogICAgaW50IGogPSBzcXJ0KG51bWJlcik7CiAgICBmb3IgKGludCBpID0gMjsgaSA8IGo7IGkrKykKICAgICAgICBpZiAobnVtYmVyJWkgPT0gMCkKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwoKICAgIHJldHVybiB0cnVlOwp9CgppbnQgbWFpbigpCnsKICAgIHN0ZDo6ZGVxdWU8aW50PiBvdXRwdXRMaW1pdHM7CiAgICBpbnQgdGVzdHNEb25lID0gMDsKCiAgICBpbnQgbnVtVGVzdHM7CiAgICBzdGQ6OmNpbiA+PiBudW1UZXN0czsKCiAgICB3aGlsZSAodGVzdHNEb25lIDw9IG51bVRlc3RzKQogICAgewogICAgICAgLy8gc3RkOjpzdHJpbmcgdGVzdDsKICAgICAgICBpbnQgZmlyc3QsIHNlY29uZDsKCiAgICAgICAgLy9nZXRsaW5lKHN0ZDo6Y2luLCB0ZXN0KTsKICAgICAgICAvL3N0ZDo6c3RyaW5nc3RyZWFtIHNzKHRlc3QpOwogICAgICAgIHN0ZDo6Y2luID4+IGZpcnN0ID4+IHNlY29uZDsKCiAgICAgICAgb3V0cHV0TGltaXRzLnB1c2hfYmFjayhmaXJzdCk7CiAgICAgICAgb3V0cHV0TGltaXRzLnB1c2hfYmFjayhzZWNvbmQpOwoKICAgICAgICArK3Rlc3RzRG9uZTsKICAgIH0KCiAgICB3aGlsZSAoIW91dHB1dExpbWl0cy5lbXB0eSgpKQogICAgewogICAgICAgIGludCBzdGFydCA9IG91dHB1dExpbWl0c1swXTsKICAgICAgICBpbnQgZmluaXNoID0gb3V0cHV0TGltaXRzWzFdOwogICAgICAgIHdoaWxlIChzdGFydCA8PSBmaW5pc2gpCiAgICAgICAgewogICAgICAgICAgICBpZiAoaXNfcHJpbWUoc3RhcnQpKQogICAgICAgICAgICAgICAgc3RkOjpjb3V0IDw8IHN0YXJ0IDw8IHN0ZDo6ZW5kbDsKICAgICAgICAgICAgKytzdGFydDsKICAgICAgICB9CiAgICAgICAgb3V0cHV0TGltaXRzLnBvcF9mcm9udCgpOwogICAgICAgIG91dHB1dExpbWl0cy5wb3BfZnJvbnQoKTsKICAgICAgICBzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0=