Practice Page Template Full Page Right Side Ads-No Mobile


PRIME1 - Prime Generator

Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!

Input

The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, n-m<=100000) separated by a space.

Output

For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.

Problem Constraints

  • 1 <= m <= n <= 1000000000
  • n - m <= 100000

Examples

Input:
2
1 10
3 5
            
Output:
2
3
5
7

3
5            
            

Test Case 1

               

Test Case 2

               

Test Case 3

               

Hint

Some content in menu 2.


/** * C Online Compiler * Use this editor to write, compile and run your C program */ #include <stdio.h> int main() { // Write your C program here printf("Hello World"); return 0; }
/** * C++ Online Compiler * Use this editor to write, compile and run your C++ program */ #include <iostream> int main() { // Write your C++ code inside main method. std::cout << "Hello World!"; return 0; }
/** * Java Online Compiler * Use this editor to write, compile and run your java program */ public class HelloWorld { public static void main(String[] args) { // Write your code inside main method. System.out.println("Hello, World!"); } }