Problem A: Eating Ordering

Problem A: Eating Ordering

Time Limit: 1 Sec  Memory Limit: 512 MB
Submit: 1072  Solved: 282
[Submit][Status][Web Board]

Description

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.

Input

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$$

Output

For eact test case output a line.

$$n$$ integer in one line, representing the ordering of dishes Dateri eats.

Sample Input

1
5 3

Sample Output

3 1 5 2 4

[Submit][Status]