An array $a$ consisting of $k$ integers is strictly increasing if $a_1 < a_2 < \dots < a_k$. For example, the arrays $[1, 3, 5]$, $[1, 2, 3, 4]$, $[3, 5, 6]$ are strictly increasing; the arrays $[2, 2]$, $[3, 7, 5]$, $[7, 4, 3]$, $[1, 2, 2, 3]$ are not.

For a strictly increasing array $a$ of $k$ elements, let's denote the characteristic as the number of different elements in the array $[a_2 - a_1, a_3 - a_2, \dots, a_k - a_{k-1}]$. For example, the characteristic of the array $[1, 3, 4, 7, 8]$ is $3$ since the array $[2, 1, 3, 1]$ contains $3$ different elements: $2$, $1$ and $3$.

You are given two integers $k$ and $n$ ($k \le n$). Construct an increasing array of $k$ integers from $1$ to $n$ with maximum possible characteristic.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 819$) — the number of test cases.

Each test case consists of one line containing two integers $k$ and $n$ ($2 \le k \le n \le 40$).


-----Output-----

For each test case, print $k$ integers — the elements of the strictly increasing array $a$ with the maximum possible characteristic. If there are multiple answers, print any of them.


-----Examples-----

Input
7
5 9
4 12
3 3
3 4
4 4
4 6
8 11
Output
1 3 4 7 8
2 4 7 12
1 2 3
1 3 4
1 2 3 4
2 4 5 6
1 2 3 5 6 7 8 11


-----Note-----

None

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Mathematics

Constructive algorithms


Solutions:
N = int(input())
for i in range(N):
	(k, n) = map(int, input().split())
	l = [1]
	t = 2
	for j in range(2, k + 1):
		if n - (l[-1] + t) >= k - j and n - (l[-1] + t) < n:
			l.append(l[-1] + t)
			t += 1
		else:
			l.append(l[-1] + 1)
	print(' '.join([str(x) for x in l]))


t = int(input())
while t:
	a = []
	(k, n) = list(map(int, input().split()))
	dif = n - k
	i = 0
	c = 1
	while i < k and c <= n:
		if i < dif:
			a.append(c)
			c += i + 2
		else:
			a.append(c)
			c += 1
		i += 1
		dif -= i
	print(' '.join(map(str, a)))
	t -= 1


for t in range(int(input())):
	l = list(map(int, input().split(' ')))
	k = l[0]
	n = l[1]
	ex = n - k
	ls = []
	ls.append(1)
	t = 1
	while len(ls) < k and ex > 0:
		if ex >= t:
			ls.append(ls[-1] + t + 1)
			ex -= t
			t += 1
		else:
			break
	while len(ls) < k:
		ls.append(ls[-1] + 1)
	print(*ls)


t = int(input(''))
for i in range(t):
	(k, n) = input('').split(' ')
	n = int(n)
	k = int(k)
	s = [0] * k
	a = 0
	b = 1
	while b <= k:
		im = b * (b + 1) // 2
		fu = im + (k - b)
		if fu <= n:
			a = im
			s[b - 1] = a
			b += 1
		else:
			a += 1
			s[b - 1] = a
			b += 1
			break
	while b <= k:
		a += 1
		s[b - 1] = a
		b += 1
	print(' '.join((str(x) for x in s)))


def solve(k, n):
	diff = n - k
	total = 0
	count = 0
	i = 1
	while total + i <= diff:
		total += i
		i += 1
		count += 1
	arr = [1]
	curr_delta = 1
	for i in range(k - 1):
		if count > 0:
			curr_delta += 1
			count -= 1
		else:
			curr_delta = 1
		arr.append(arr[-1] + curr_delta)
	return arr
for _ in range(int(input())):
	(k, n) = map(int, input().split())
	res = solve(k, n)
	print(' '.join(map(str, res)))


for i in range(int(input())):
	(m, n) = map(int, input().split())
	kk = n - m
	k = int((-1 + (1 + 8 * kk) ** 0.5) / 2)
	r = kk - k * (k + 1) // 2
	a = 0
	s = ''
	for i in range(min(m, k + 1)):
		a = a + 1 + i
		s += str(a) + ' '
	m = m - k - 1
	for i in range(max(m, 0)):
		a = a + 1
		s += str(a) + ' '
	print(s)


t = int(input())

def solve():
	(k, n) = list(map(int, input().split()))
	triangle = 0
	ans = []
	for i in range(1, k + 1):
		if i * (i + 1) / 2 + (k - i) <= n:
			triangle = i
		else:
			break
	for i in range(1, triangle + 1):
		ans.append(i * (i + 1) // 2)
	x = ans[-1]
	for i in range(k - triangle):
		ans.append(x + i + 1)
	for i in range(len(ans)):
		ans[i] = str(ans[i])
	print(' '.join(ans))
for i in range(t):
	solve()