#K60877. Pass the Book
Pass the Book
Pass the Book
In this problem, you are given a circular game played by n students. The game starts with student 1 holding a book. In each step, the book is passed by skipping k - 1 students. Formally, if the current student is c, the next student to receive the book is determined by the formula: $$next = ((c + k - 1)\,\bmod\,n) + 1.$$
Your task is to determine the order in which the students receive the book. The process continues until each student has received the book exactly once. Make sure your output matches the order of the passes as described.
inputFormat
The first line contains an integer T, the number of test cases. Each of the next T lines contains two space-separated integers n and k, where:
- n is the number of students, and
- k is the step count used in the book passing.
Note that the book passing follows a cyclic order and always starts from student 1.
outputFormat
For each test case, output a single line containing n space-separated integers which represent the order in which the students receive the book.
## sample3
5 2
4 1
6 3
1 3 5 2 4
1 2 3 4
1 4 1 4 1 4
</p>