PROBLEM STATEMENT Primes are the buiding blocks of all numbers, and the natural number sequence has an infinite number of these blocks. Our goal is to construct our very own number system with a finite number of such blocks. You will be given a number (m) and using only the primes in the range [1,m] find the first n numbers of our number system in ascending order. That is, using all primes <= m (say 2,3,..,p) find the first n numbers formed by repeated multiplication of these primes (numbes of the form 2^i3^j...p^k).
INPUT FORMAT First line gives the number of test inputs (K). Each line after that (for K lines) gives the number of numbers to be printed (n) and the max value of primes that can be used (m),separated by a space.
OUTPUT FORMAT Print K lines, each line containing the correct list of space-separated first n numbers.
INPUT CONSTRAINTS M < 100; n < 2^16; m < 2^16;
Please note that the sample output contains only 2 lines. The second line might be wrapping into a third line.