Problems
10074 - War of Numbers
SUBMIT PROBLEM

War of Numbers

Time Limit: 0.5 sec

 

The Problem

A terrible war has took place between LALA and KALA.

After the death of JIRA and KIRA (KALA's knight) , KALA got scared. He used his mind and presented a proposal of a war of numbers instead of Guns and Mortars to LALA.

According to him, You will select a number N, KALA has to subtract a number which is at least 1 and at most k. After that LALA has to subtract a number at least 1 and at most k. And they both subtract alternatively till the number becomes less than 1. The last player to subtract will be the winner.

You have to find out the p smallest numbers that can be used as N so that LALA will always win. Both LALA and KALA are genius-minded and play optimally at every point.

 

The Input

First line contains one integer T(1<=T<=10) - No. of test cases. After that , the next T(1<=N<10^6) lines will contain two space-separated integers p(1<=p<=50)  and  k(1<=k<=10000).

 

The Output

For every test case print the p smallest space-separated integers that can be taken as N which assures the winning of LALA.

 

Sample Input

2

1 4

2 3

 

Sample Output

5

4 8

 

 

 

 

Aracari contest [School & College Level]

Problem Setter: Parag Paul