13401340 SUSTech Online Judge
Problem 1340 --Eating Ordering

1340: Eating Ordering

Time Limit: 1 Sec  Memory Limit: 512 MB
Submit: 1066  Solved: 278
[Submit][Status][Web Board]


K‘ , is a well-known character in The King of Fighters series developed by SNK. Dateri likes K' so he likes number k. One day he enters a restaurant and orders \(n\) dishes. He wants to eat them one by one. He has an idea to decide the order of eating: Dishes are in a circle, numbered from 1 to \(n\) in clockwise direction. Dateri begins counting at dish 1 and proceeds around the circle in clockwise direction. When he skips \(k-1\) dishes, he will eat the next dish. The procedure is repeating until there is no dishes. You should output the ordering of dishes Dateri eats.


The first line of input contains an integer T (1≤T≤10) which is the total number of test cases.

For each test cases, there are two integers in one line, \(n\) and \(k\) (\(1<=n<=1e5\)).

It satisfies that in all cases \(\sum n \cdot k<=6e7\)


For eact test case output a line.

\(n\) integer in one line, representing the ordering of dishes Dateri eats.

Sample Input

5 3

Sample Output

3 1 5 2 4