Aujasvit just came up with a new game to play with his friends. N people stand in a circle, each assigned an index from 1 to N in clockwise order. Then the following operation is done N-1 times.

The person with the lowest index holds a coin.
Then, the coin then moves to the next person clockwise M-1 times.
Then, the person who is holding the coin is removed from the circle.

The last person remaining after N-1 operations is the winner.

Aujasvit has already decided on the integer M to be used in the game. Before inviting people to play his game, Aujasvit wants to know the winner if the game has 1 player, 2 players, 3 players, ..., X players. That is, you need to output the winner when N = 1, N = 2, ..., N = X.

------ Input Format ------ 

- The first line of each input contains T - the number of test cases. The test cases then follow.
- The only line of each test case contains two space-separated integers M and X.

------ Output Format ------ 

For each testcase, output X integers A_{1}, A_{2}, \dots, A_{X}, where A_{i} is the index of the winner if i people are playing this game.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ M ≤ 10^{9}$
$1 ≤ X ≤ 10000$
- Sum of $X$ over all testcases is not more than $5 \cdot 10^{5}$

----- Sample Input 1 ------ 
1
2 3

----- Sample Output 1 ------ 
1 1 1
----- explanation 1 ------ 
- Test case $1$:
- When there is only $1$ player, they are the winner. Therefore player $1$ wins.
- When there are $2$ players, player $2$ is removed in the first round. Therefore player $1$ wins.
- When there are $3$ players, player $2$ is removed in the first round, and player $3$ is removed in the second round. Therefore player $1$ wins.

Difficulty: MEDIUM_HARD
Tags: Number theory

Dynamic programming
Skill types: Dynamic programming

Starter code:

Solutions:
from math import gcd

def solve(M, x):
	if M == 1:
		return [i + 1 for i in range(x)]
	ans = [1]
	for n in range(2, x + 1):
		if n >= M:
			ans.append(ans[-1])
		elif M % n != 0 and M % n <= ans[-1]:
			ans.append(ans[-1] + 1)
		else:
			ans.append(ans[-1])
	print(*ans)
t = int(input())
for xyz in range(t):
	(M, x) = map(int, input().split())
	solve(M, x)


t = int(input())
for i in range(t):
	w = list(map(int, input().split()))
	(m, x) = (w[0], w[1])
	a = [0 for r in range(x + 1)]
	a[1] = 1
	if w[1] > 1:
		for k in range(2, x + 1, 1):
			q = 0
			if m % k == 0:
				q = x
			else:
				q = m % k
			if q > a[k - 1]:
				a[k] = a[k - 1]
			else:
				a[k] = a[k - 1] + 1
	for j in range(1, x + 1, 1):
		print(a[j], end=' ')


t = int(input())
for i in range(t):
	(m, x) = map(int, input().split())
	ans = [0, 1] + [0] * (x - 1)
	for j in range(2, x + 1):
		c = m % j if m % j else j
		ans[j] = ans[j - 1] + (ans[j - 1] >= c)
	print(*[ans[j] for j in range(1, x + 1)])


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	ans = [0, 1] + [0] * (x - 1)
	for i in range(2, x + 1):
		tp = m % i if m % i else i
		ans[i] = ans[i - 1] + (ans[i - 1] >= tp)
	print(*[ans[i] for i in range(1, x + 1)])


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	win = [1]
	print(1, end=' ')
	for i in range(1, x):
		if win[i - 1] >= m % (i + 1) and m % (i + 1) != 0:
			print(win[i - 1] + 1, end=' ')
			win.append(win[i - 1] + 1)
		else:
			print(win[i - 1], end=' ')
			win.append(win[i - 1])
	print('')


import sys, io, os
for _ in range(int(input())):
	(mm, xx) = map(int, input().split())
	aa = [0, 1] + [0 for ii in range(xx - 1)]
	for ii in range(2, xx + 1):
		aa[ii] = aa[ii - 1] + (aa[ii - 1] >= (mm % ii if mm % ii else ii))
	print(*[aa[ii + 1] for ii in range(xx)])


import math
testcase = int(input())
while testcase:
	testcase -= 1
	(M, X) = input().split()
	M = int(M)
	X = int(X)
	ans = 1
	print(ans, end=' ')
	for i in range(2, X + 1):
		f = M % i
		if f == 0:
			f = i
		if ans >= f:
			ans += 1
		print(ans, end=' ')
	print()


import sys
sys.setrecursionlimit(10000000)

def jos(n, k):
	if n == 1:
		print(1, end=' ')
		return 1
	a = jos(n - 1, k)
	if (k - 1) % n == 0:
		print(a + 1, end=' ')
		return a + 1
	if a <= (k - 1) % n:
		print(a, end=' ')
		return a
	else:
		print(a + 1, end=' ')
		return a + 1
case = int(input())
for u in range(case):
	(M, X) = list(map(int, input().split(' ')))
	jos(X, M)


t = int(input())
for _ in range(t):
	(m, x) = map(int, input().split())
	lst = [k for k in range(x + 1)]
	lst[1] = 1
	ans = []
	for i in range(2, x + 1):
		calc = m % i
		if calc == 0:
			calc = i
		lst[i] = lst[i - 1]
		if lst[i] >= calc:
			lst[i] += 1
	lst.pop(0)
	print(*lst)


from sys import stdin
input = stdin.readline

def solve(M, X):
	winner = [0] * (X + 1)
	for N in range(2, X + 1):
		if winner[N - 1] <= (M - 1) % N - 1:
			winner[N] = winner[N - 1]
		else:
			winner[N] = winner[N - 1] + 1
	for i in range(X + 1):
		winner[i] += 1
	return winner[1:]
T = int(input().strip())
for problem in range(1, T + 1):
	(M, X) = [int(x) for x in input().strip().split()]
	print(*solve(M, X))


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	m -= 1
	l = [1] * x
	for i in range(1, x):
		temp = m % (i + 1) + 1
		if l[i - 1] < temp:
			l[i] = l[i - 1]
		else:
			l[i] = l[i - 1] + 1
	print(*l)


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	arr = [0 for _ in range(x + 1)]
	arr[1] = 1
	if x > 1:
		for i in range(2, x + 1):
			if m % i != 0:
				temp = m % i
			else:
				temp = x
			if temp > arr[i - 1]:
				arr[i] = arr[i - 1]
			else:
				arr[i] = arr[i - 1] + 1
	for i in range(1, x + 1):
		print(arr[i], end=' ')


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	l = []
	for i in range(0, x):
		l.append(i)
		l[0] = 1
		a = (m - 1) % (i + 1) + 1
		if l[i - 1] < a:
			l[i] = l[i - 1]
		else:
			l[i] = l[i - 1] + 1
	print(*l, sep=' ')


t = int(input())
for i in range(t):
	(m, x) = map(int, input().split())
	l = [1] * (x + 1)
	print(l[1], end=' ')
	for i in range(2, x + 1):
		if m % i == 0:
			x = i
		else:
			x = m % i
		l[i] = l[i - 1]
		if l[i] >= x:
			l[i] += 1
		print(l[i], end=' ')
	print()


import sys
sys.setrecursionlimit(10 ** 6)

def jos_m1(n: int, m: int) -> int:
	if n == 1:
		print(1, end=' ')
		return 1
	if (m - 1) % n == 0:
		z = (jos_m1(n - 1, m) + 1) % (n + 1)
		print(z, end=' ')
		return z
	else:
		x = jos_m1(n - 1, m)
		if x <= (m - 1) % n:
			print(x % (n + 1), end=' ')
			return x % (n + 1)
		else:
			print((x + 1) % (n + 1))
			return (x + 1) % (n + 1)
T = int(input())
for i in range(T):
	(m, x) = list(map(int, input().split()))
	jos_m1(x, m)
	print()


t = int(input())

def solve(m, x):
	dp = [0, 1]
	for i in range(2, x + 1):
		md = (m - 1) % i + 1
		if md > dp[i - 1]:
			dp.append(dp[i - 1])
		else:
			dp.append(dp[i - 1] + 1)
	return dp[1:]
for _ in range(t):
	(m, x) = list(map(int, input().split()))
	ans = solve(m, x)
	for i in ans:
		print(i, end=' ')


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	arr = []
	m = m - 1
	arr.append(1)
	for i in range(1, x):
		p = m % (i + 1) + 1
		if arr[i - 1] < p:
			arr.append(arr[i - 1])
		else:
			arr.append(arr[i - 1] + 1)
	print(*arr)


for _ in range(int(input())):
	(m, x) = [int(i) for i in input().split()]
	m -= 1
	(i, p) = (1, 1)
	print(p, end=' ')
	while i < x:
		val = m % (i + 1) + 1
		if val > p:
			print(p, end=' ')
		else:
			p = p + 1
			print(p, end=' ')
		i += 1
	print()


def get(num, m):
	if m % num == 0:
		return num
	return m % num
for _ in range(int(input())):
	(m, x) = map(int, input().split())
	ans = [1] * x
	for i in range(1, x):
		ans[i] = ans[i - 1] if get(i + 1, m) > ans[i - 1] else ans[i - 1] + 1
	print(*ans)


t = int(input())
for _ in range(t):
	(m, n) = map(int, input().split())
	a = [0] * (n + 1)
	a[1] = 1
	for i in range(2, n + 1):
		if m % i != 0:
			idx = m % i
		else:
			idx = m
		if a[i - 1] < idx:
			a[i] = a[i - 1]
		else:
			a[i] = a[i - 1] + 1
	a = a[1:]
	print(*a)


T = input()
for i in range(int(T)):
	(M, X) = map(int, input().split())
	A = [1] * X
	for j in range(1, X):
		m = (M - 1) % (j + 1)
		if A[j - 1] < m + 1:
			A[j] = A[j - 1]
		else:
			A[j] = A[j - 1] + 1
	print(*A)


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	win = [1] * x
	for n in range(1, x):
		if m % (n + 1) == 0:
			f = n + 1
		else:
			f = m % (n + 1)
		if f > win[n - 1]:
			win[n] = win[n - 1]
		else:
			win[n] = win[n - 1] + 1
	print(*win)


x = int(input())
for i in range(x):
	(m, x) = list(map(int, input().split()))
	print(1, end=' ')
	y = 1
	for k in range(2, x + 1):
		z = m % k
		if z == 0:
			print(y, end=' ')
		elif z <= y and z != 0:
			print(y + 1, end=' ')
			y += 1
		else:
			print(y, end=' ')
	print()


for tc in range(int(input())):
	(m, x) = map(int, input().split())
	arr = [1] * x
	arr[0] = 1
	m = m - 1
	for i in range(1, x):
		t = m % (i + 1) + 1
		if arr[i - 1] < t:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	print(*arr)


import math
import os
import random
import re
import sys
T = int(input())
for _ in range(T):
	(M, X) = map(int, input().split())
	l = [1]
	for i in range(2, X + 1):
		if (M - 1) % i + 1 > l[-1]:
			l.append(l[-1])
		else:
			l.append(l[-1] + 1)
	print(*l)


for t in range(int(input())):
	L = [1]
	(M, X) = list(map(int, input().split()))
	for i in range(2, X + 1):
		k = M % i
		if k == 0:
			k = i
		if k > L[-1]:
			L.append(L[-1])
		else:
			L.append(L[-1] + 1)
	L = list(map(str, L))
	print(' '.join(L))


test = int(input())
while test:
	test -= 1
	(m, x) = map(int, input().split())
	m -= 1
	arr = [0] * x
	arr[0] = 1
	for i in range(1, x):
		ps = m % (i + 1) + 1
		if arr[i - 1] < ps:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	for i in range(x):
		print(arr[i], end=' ')


t = int(input())
for q in range(t):
	(m, x) = map(int, input().split())
	m -= 1
	arr = [0] * x
	arr[0] = 1
	for i in range(1, x):
		ps = m % (i + 1) + 1
		if arr[i - 1] < ps:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	for i in range(x):
		print(arr[i], end=' ')


for _ in range(int(input())):
	(m, k) = map(int, input().split())
	last = []
	for i in range(k):
		if i == 0:
			last.append(0)
			continue
		last.append((m % (i + 1) - 1) % (i + 1))
	out = [0]
	for i in last[1:]:
		if len(out) >= m - 1:
			out.append(out[-1])
			continue
		if out[-1] >= last[len(out)]:
			out.append(out[-1] + 1)
		else:
			out.append(out[-1])
	print(' '.join(map(lambda x: str(x + 1), out)))


def gl():
	return [int(x) for x in input().split()]
for _ in range(int(input())):
	(m, x) = gl()
	m -= 1
	l = [1] * x
	for i in range(1, x):
		l[i] = l[i - 1] if l[i - 1] < m % (i + 1) + 1 else l[i - 1] + 1
	print(*l)


x = int(input(''))
li = []
for i in range(x):
	y = input('')
	y = list(map(int, y.split()))
	li.append(y)
for l in li:
	m = l[0] - 1
	x = l[1]
	counter = 1
	while counter != x + 1:
		if counter == 1:
			print(1, end=' ')
			counter = counter + 1
		elif counter == 2:
			array = [1, 2]
			array.pop(m % len(array))
			indi = array[0] - 1
			print(array[0], end=' ')
			counter = counter + 1
		else:
			popped = m % counter + 1
			if indi < m % counter:
				ans = indi + 1
				indi = ans - 1
			else:
				ans = indi + 2
				indi = ans - 1
			print(ans, end=' ')
			counter = counter + 1
	print('')


t = int(input())
for i in range(t):
	(m, x) = map(int, input().split())
	m -= 1
	l = []
	l.append(1)
	for i in range(1, x):
		a = m % (i + 1) + 1
		if l[i - 1] < a:
			l.append(l[i - 1])
		else:
			l.append(l[i - 1] + 1)
	for i in l:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	(mm, xx) = map(int, input().split())
	aa = [0, 1] + [0 for ii in range(xx - 1)]
	for ii in range(2, xx + 1):
		aa[ii] = aa[ii - 1] + (aa[ii - 1] >= (mm % ii if mm % ii else ii))
	print(*[aa[ii + 1] for ii in range(xx)])


t = int(input())
while t:
	t -= 1
	(m, x) = map(int, input().split())
	res = [1]
	for i in range(2, x + 1):
		if (m - 1) % i + 1 > res[-1]:
			res.append(res[-1])
		else:
			res.append(res[-1] + 1)
	print(*res)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(m, k) = map(int, input().split())
	m -= 1
	ans = -1
	dp = [0] * k
	dp[0] = 1
	for i in range(1, k):
		ans = m % (i + 1) + 1
		if dp[i - 1] < ans:
			dp[i] = dp[i - 1]
		else:
			dp[i] = dp[i - 1] + 1
	print(*dp)


t = int(input())
for _ in range(t):
	(m, x) = map(int, input().split())
	arr = []
	for i in range(1, x + 1):
		arr.append(i)
	dp = [0] * (x + 1)
	dp[1] = 0
	print(arr[dp[1]], end=' ')
	for i in range(2, x + 1):
		rem = (m - 1) % i
		if rem <= dp[i - 1]:
			print(arr[dp[i - 1] + 1], end=' ')
			dp[i] = dp[i - 1] + 1
		else:
			print(arr[dp[i - 1]], end=' ')
			dp[i] = dp[i - 1]
	print()


for i in range(int(input())):
	(m, x) = map(int, input().split())
	st = [0] * (x + 1)
	st[1] = 1
	for i in range(2, x + 1):
		temp = m % i
		if temp == 0:
			temp = i
		st[i] = st[i - 1]
		if st[i] >= temp:
			st[i] += 1
	for i in range(1, x + 1):
		print(st[i], end=' ')
	print('\n')


import sys
input = sys.stdin.readline
output = sys.stdout.write
for _ in range(int(input())):
	(m, x) = map(int, input().split())
	arr = [0] * x
	arr[0] = 1
	a1 = 0
	m = m - 1
	for i in range(1, x):
		a1 = m % (i + 1) + 1
		if arr[i - 1] < a1:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	for i in range(x):
		print(arr[i], end=' ')
	print()


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	m = m - 1
	arr = []
	for i in range(1, n + 1):
		if not arr:
			arr.append(1)
		elif i >= m + 1:
			arr.append(arr[-1])
		else:
			idx = arr[-1]
			l = m % i + 1
			if l <= idx:
				idx += 1
			arr.append(idx)
	for i in range(n - 1):
		print(arr[i], end=' ')
	print(arr[-1])


for _ in range(int(input())):
	(n, l) = map(int, input().split())
	p = [0, 1] + [0 for i in range(l - 1)]
	for i in range(2, l + 1):
		p[i] = p[i - 1] + (p[i - 1] >= (n % i if n % i else i))
	print(*[p[i + 1] for i in range(l)])


t = int(input())
for _ in range(t):
	(m, x) = input().split()
	m = int(m)
	x = int(x)
	m -= 1
	arr = [0] * x
	arr[0] = 1
	var = 0
	for i in range(1, x):
		var = m % (i + 1) + 1
		if arr[i - 1] < var:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	for i in range(0, x):
		print(arr[i], end=' ')
	print()


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	store = [0] * (x + 1)
	store[1] = 1
	for i in range(2, x + 1):
		temp = m % i
		if temp == 0:
			temp = i
		store[i] = store[i - 1]
		if store[i] >= temp:
			store[i] += 1
	print(*store[1:])


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	for _ in range(1, ii() + 1):
		(m, x) = mi()
		c = 1
		m -= 1
		elm = [i + 1 for i in range(x)]
		print(1, end=' ')
		for i in range(2, x + 1):
			p1 = 1 + m % i
			if p1 == 1:
				c = elm[c]
			elif c < p1:
				c = elm[c - 1]
			else:
				c = elm[c]
			print(c, end=' ')
		print()
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


t = int(input())
for _ in range(t):
	(m, x) = map(int, input().split())
	arr = [1] * x
	m = m - 1
	for i in range(1, x):
		a = m % (i + 1) + 1
		if arr[i - 1] < a:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	for i in arr:
		print(i, end=' ')
	print()


try:
	for _ in range(int(input())):
		(m, x) = map(int, input().split())
		l = [0 for _ in range(x)]
		l[0] = 1
		for i in range(1, x):
			temp = (m - 1) % (i + 1) + 1
			if l[i - 1] < temp:
				l[i] = l[i - 1]
			else:
				l[i] = l[i - 1] + 1
		print(*l)
except:
	pass


for i in range(int(input())):
	(m, x) = map(int, input().split())
	l = ['1']
	a = 1
	for j in range(2, x + 1):
		if j > m - 1:
			l.append(str(a))
		else:
			r = (m - 1) % j
			if r < a:
				a += 1
			l.append(str(a))
	print(' '.join(l))


def sol(m, n):
	arr = [1] + [0] * (n - 1)
	for i in range(1, n):
		pos = m % (i + 1) + 1
		if arr[i - 1] < pos:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	return arr
t = int(input())
for tc in range(0, t):
	(m, n) = map(int, input().split())
	m -= 1
	ans = sol(m, n)
	print(*ans)


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	lst = []
	lst.append(1)
	for i in range(1, x):
		x = (m - 1) % (i + 1) + 1
		if lst[i - 1] < x:
			lst.append(lst[i - 1])
		else:
			lst.append(lst[i - 1] + 1)
	print(*lst, sep=' ')


try:
	for _ in range(int(input())):
		(m, x) = map(int, input().split())
		lst = [1]
		for i in range(1, x):
			k = (m - 1) % (i + 1) + 1
			if lst[i - 1] < k:
				lst.append(lst[i - 1])
			else:
				lst.append(lst[i - 1] + 1)
		for i in lst:
			print(i, end=' ')
except:
	pass


t = int(input())
while t > 0:
	t -= 1
	(m, x) = map(int, input().split())
	m -= 1
	a = [0] * x
	a[0] = 1
	ps = 0
	for i in range(1, x):
		ps = m % (i + 1) + 1
		a[i] = a[i - 1] * 1
		if a[i - 1] >= ps:
			a[i] += 1
	print(*a)


t = int(input())
while t > 0:
	(m, x) = map(int, input().split())
	m -= 1
	a = [0] * x
	a[0] = 1
	for i in range(1, x):
		temp = m % (i + 1) + 1
		if a[i - 1] < temp:
			a[i] = a[i - 1]
		else:
			a[i] = a[i - 1] + 1
	for i in range(x):
		print(a[i], end=' ')
	print(' ')
	t = t - 1


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	a = []
	m = m - 1
	a.append(1)
	for i in range(1, x):
		b = m % (i + 1) + 1
		if a[i - 1] < b:
			a.append(a[i - 1])
		else:
			a.append(a[i - 1] + 1)
	for i in a:
		print(i, end=' ')
	print()


for t in range(int(input())):
	(m, n) = map(int, input().split())
	print(1)
	l = 0
	for i in range(1, n):
		a = (m - 1) % (i + 1)
		if l >= a:
			l = l + 1
		print(l + 1)


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	d = [0] * (n + 1)
	d[1] = 0
	for i in range(2, n + 1):
		z = (m - 1) % i
		if z <= d[i - 1]:
			d[i] = d[i - 1] + 1
		else:
			d[i] = d[i - 1]
	x = ''
	for a in range(1, n + 1):
		x += str(d[a] + 1) + ' '
	print(x)


for _ in range(int(input())):
	(m, x) = list(map(int, input().split()))
	m -= 1
	arr = [0] * x
	arr[0] = 1
	for i in range(1, x):
		y = m % (i + 1) + 1
		if arr[i - 1] < y:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	for i in arr:
		print(i, end=' ')


for t in range(int(input())):
	(m, n) = map(int, input().split())
	ans = [1]
	for i in range(1, n):
		p = (m - 1) % (i + 1) + 1
		if ans[i - 1] < p:
			ans.append(ans[i - 1])
		else:
			ans.append(ans[i - 1] + 1)
	print(*ans)


for _ in range(int(input())):
	[m, x] = [int(j) for j in input().split()]
	ps = 0
	l = []
	m = m - 1
	for i in range(x):
		l.append('0')
	l[0] = 1
	for i in range(1, x):
		ps = m % (i + 1) + 1
		if l[i - 1] < ps:
			l[i] = l[i - 1]
		else:
			l[i] = l[i - 1] + 1
	for i in range(x):
		print(l[i], end=' ')


for _ in range(int(input())):
	(m, x) = map(int, input().split())
	qwerty = [0, 1] + [0 for p in range(x - 1)]
	for i in range(2, x + 1):
		qwerty[i] = qwerty[i - 1] + (qwerty[i - 1] >= (m % i if m % i else i))
	print(*[qwerty[i + 1] for i in range(x)])


from sys import stdin, stdout
from random import randint
for _ in range(int(stdin.readline())):
	(m, x) = map(int, stdin.readline().split())
	a = [0 for i in range(x)]
	(a[0], m) = (1, m - 1)
	for i in range(1, x):
		b = m % (i + 1) + 1
		a[i] = a[i - 1] if b > a[i - 1] else a[i - 1] + 1
	print(*a)


import heapq
import math
import sys
import collections
import bisect
import time
import random
import itertools
import string
from collections import Counter, defaultdict

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	(m, x) = get_ints()
	m -= 1
	ans = []
	ans.append(1)
	for i in range(1, x):
		val = m % (i + 1) + 1
		if ans[i - 1] < val:
			ans.append(ans[-1])
		else:
			ans.append(ans[-1] + 1)
	print(*ans)


t = int(input())
for i in range(t):
	(m, x) = list(map(int, input().split()))
	m -= 1
	lst = list(range(x))
	lst[0] = 1
	for i in range(1, x):
		a = m % (i + 1) + 1
		if lst[i - 1] < a:
			lst[i] = lst[i - 1]
		else:
			lst[i] = lst[i - 1] + 1
	print(*lst, end=' ')


for _ in range(int(input())):
	(m, x) = [int(i) for i in input().split()]
	m = m - 1
	a = [i for i in range(0, x)]
	if m == 0:
		for i in range(1, x + 1):
			print(i, end=' ')
		print('')
	if m == 1:
		for i in range(1, x + 1):
			print(1, end=' ')
		print('')
	else:
		print(1, end=' ')
		i = [0]
		for j in range(1, x):
			if j + 1 > m:
				break
			d = m % (j + 1)
			if i[j - 1] >= d:
				print(i[j - 1] + 2, end=' ')
				i.append(i[j - 1] + 1)
			else:
				print(i[j - 1] + 1, end=' ')
				i.append(i[j - 1])
		if j + 1 > m:
			for j in range(x - m):
				print(i[-1] + 1, end=' ')
		print('')


try:
	for test in range(int(input())):
		(man, axe) = map(int, input().split())
		ls = [0] * (axe + 1)
		ls[1] = 1
		for i in range(2, axe + 1):
			t = man % i
			if t == 0:
				t = i
			ls[i] = ls[i - 1]
			if ls[i] >= t:
				ls[i] += 1
		for i in range(1, axe + 1):
			print(ls[i], end=' ')
		print()
except:
	pass


for _ in range(int(input())):
	(m, x) = map(int, input().split(' '))
	arr = [0 for i in range(x)]
	arr[0] = 1
	for i in range(1, x):
		s = (m - 1) % (1 + i) + 1
		if arr[i - 1] < s:
			arr[i] = arr[i - 1]
		else:
			arr[i] = arr[i - 1] + 1
	print(*arr)


for _ in range(int(input())):
	(num, xo) = map(int, input().split())
	st = [None] * int(xo + 1)
	st.insert(1, 1)
	for i in range(2, xo + 1):
		tempo = num % i
		if tempo == 0:
			tempo = i
		st[i] = st[i - 1]
		if st[i] >= tempo:
			st[i] += 1
	for k in range(1, xo + 1):
		print(st[k], end=' ')
	print()