Problem: Shridhar 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 first line contains t, the number of test cases (less then or equal to 10). 

Followed by t lines which contain 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.  Separate the answers for each test case by an empty line.

Example
Input:
2
1 10
3 5

Output:
2
3
5
7

3
5

Warning: large Input/Output data, be careful with certain languages (though most should be OK if the algorithm is well designed)

Solution (in PYTHON):

Solution:
import  math, sys

already = 31623
primes = range(already)
def find_primes():
   for p in primes[2:]:
        top = len(primes) - 1
        if p:
            bottom = p * p 
            primes[p*p::p] = [0] * ( 1+ (top - bottom )  // p ) 



find_primes()

primes = filter(None, primes)
primes = primes[1:]

def get_nearest_prime_index(l1 , l2, n ) :
   mid = int (( l1 + l2 ) / 2 ); 
   if ( l2 - l1 <= 1) :
        return l1
   if ( primes[mid] > n ) : 
        return get_nearest_prime_index(l1, mid, n )
   else: 
       return get_nearest_prime_index(mid, l2, n ) 


def get_first_multiple_in_range(x, n, m ):
    if n <= x and x <= m : 
        return x
    return int ( x * math.ceil( float(n) / float ( x) ) )
    
def primes_in_range(n , m ) : 
    pr1 = []
    if m < already:
        res = filter( lambda x : n<= x and x<= m , primes) 
        return res
    elif n < already : 
	res = filter( lambda x : n<= x and x<= already , primes ) 
        pr1 = res
    	n = already 

    pr = range(n , m + 1 ) 
    lim = 1 + get_nearest_prime_index(0 , len(primes), int ( math.sqrt(m))) 
    #print "Limit is at index {0} with val {1}".format(lim, primes[lim]);
    for p in primes[:lim]:
        #print "prime" , p
        fm = get_first_multiple_in_range(p , n , m ) 
        idx = fm - n 
	#print "First multiple {0} at index {1}".format(fm, idx)
	#print pr[:50]
        pr[idx::p] = [0] * len ( pr[idx::p])
    pr2 = filter( None, pr)
    return pr1 + pr2


def main():
    f = sys.stdin
    cases  = int ( f.readline())
    for i in range(cases) : 
        nos = f.readline().split()
        nos = map(int, nos)
        pr = primes_in_range(nos[0], nos[1])
        for p in pr: 
            print p
        if cases  != i : 
            print ""
            

if __name__ == "__main__":
    main()