You are given a complete directed graph $K_n$ with $n$ vertices: each pair of vertices $u \neq v$ in $K_n$ have both directed edges $(u, v)$ and $(v, u)$; there are no self-loops.

You should find such a cycle in $K_n$ that visits every directed edge exactly once (allowing for revisiting vertices).

We can write such cycle as a list of $n(n - 1) + 1$ vertices $v_1, v_2, v_3, \dots, v_{n(n - 1) - 1}, v_{n(n - 1)}, v_{n(n - 1) + 1} = v_1$ — a visiting order, where each $(v_i, v_{i + 1})$ occurs exactly once.

Find the lexicographically smallest such cycle. It's not hard to prove that the cycle always exists.

Since the answer can be too large print its $[l, r]$ segment, in other words, $v_l, v_{l + 1}, \dots, v_r$.


-----Input-----

The first line contains the single integer $T$ ($1 \le T \le 100$) — the number of test cases.

Next $T$ lines contain test cases — one per line. The first and only line of each test case contains three integers $n$, $l$ and $r$ ($2 \le n \le 10^5$, $1 \le l \le r \le n(n - 1) + 1$, $r - l + 1 \le 10^5$) — the number of vertices in $K_n$, and segment of the cycle to print.

It's guaranteed that the total sum of $n$ doesn't exceed $10^5$ and the total sum of $r - l + 1$ doesn't exceed $10^5$.


-----Output-----

For each test case print the segment $v_l, v_{l + 1}, \dots, v_r$ of the lexicographically smallest cycle that visits every edge exactly once.


-----Example-----
Input
3
2 1 3
3 3 6
99995 9998900031 9998900031

Output
1 2 1 
1 3 2 3 
1 



-----Note-----

In the second test case, the lexicographically minimum cycle looks like: $1, 2, 1, 3, 2, 3, 1$.

In the third test case, it's quite obvious that the cycle should start and end in vertex $1$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Greedy algorithms

Graph algorithms

Implementation

Constructive algorithms


Solutions:
for _ in range(int(input())):
	(n, left, right) = tuple(map(int, input().split()))
	maximal = n * (n - 1) + 1
	if left == maximal:
		print('1')
		continue
	if right == maximal:
		end_1 = True
	else:
		end_1 = False
	a = []
	summa = 0
	i = (n - 1) * 2
	cnt = 0
	while summa + i < left:
		summa += i
		i -= 2
		cnt += 1
	left -= summa
	right -= summa
	summa = 0
	while left <= right:
		while left <= summa + i and left <= right:
			if left % 2 == 1:
				print(cnt + 1, end=' ')
			else:
				print(cnt + left // 2 + 1, end=' ')
			left += 1
		left -= i
		right -= i
		summa = 0
		i -= 2
		cnt += 1
		if i == 0 and end_1:
			print(1, end=' ')
			break
	print()
	if left > right:
		continue


import sys
input = sys.stdin.buffer.readline

def prog():
	for _ in range(int(input())):
		(n, l, r) = map(int, input().split())
		l -= 1
		r -= 1
		a = 1
		new = 2 * (n - a)
		while new < l:
			l -= new
			r -= new
			a += 1
			new = 2 * (n - a)
		total = new - l - 2 * (n - a)
		if l == 0 and a == 1:
			segment = [1]
			l += 1
			r += 1
		else:
			segment = []
		while total < r and a <= n:
			segment_a = []
			for i in range(1 + a, n):
				segment_a.extend([i, a])
			if n > 1 + a:
				segment_a.extend([n, 1 + a])
			segment.extend(segment_a)
			total += 2 * (n - a)
			a += 1
		if a == n + 1 or n == 2:
			segment.extend([n, 1])
		sys.stdout.write(' '.join(map(str, segment[l - 1:r])) + '\n')
prog()


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(n, l, r):
	(lo, hi) = (1, n)
	while lo <= hi:
		k = (lo + hi) // 2
		s = k * (2 * n - 1 - k)
		if s < l:
			lo = k + 1
		else:
			hi = k - 1
	k = lo
	s = k * (2 * n - 1 - k)
	b = k
	row = []
	for i in range(b + 1, n + 1):
		row.append(b)
		row.append(i)
	ans = row[l - s - 1:]
	d = r - l + 1
	if len(ans) >= d:
		return ans[:d]
	while len(ans) < d:
		b += 1
		row = []
		for i in range(b + 1, n + 1):
			row.append(b)
			row.append(i)
		if not row:
			break
		ans += row
	ans.append(1)
	return ans[:d]
T = int(input())
ans = []
for ti in range(T):
	(N, L, R) = map(int, input().split())
	ans.append(solve(N, L, R))
print('\n'.join([' '.join(map(str, v)) for v in ans]))


import sys
import heapq

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

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

def rlinput():
	return list(map(int, input().split()))

def YES(flag):
	if flag:
		return 'YES'
	return 'NO'

def main():

	def F():
		return l <= w and w <= r
	(n, l, r) = rinput()
	res = []
	w = 1
	if F():
		res.append(1)
	for i in range(2, n):
		w += 1
		if F():
			res.append(i)
		w += 1
		if F():
			res.append(1)
	w += 1
	if F():
		res.append(n)
	for i in range(2, n):
		w += 1
		if F():
			res.append(i)
		for o in range(max(w + 1, l), min(w + (n - i - 1) * 2 + 1, r + 1)):
			if (o - w) % 2 == 0:
				res.append(i)
			else:
				res.append((o - w - 1) // 2 + i + 1)
		w += (n - i - 1) * 2 + 1
		if F():
			res.append(n)
	w += 1
	if F():
		res.append(1)
	print(*res)
for i in range(iinput()):
	main()


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def gen_arr(v):
	if N - v == 0:
		return [1]
	n = (N - v) * 2
	res = [0] * n
	x = v + 1
	for i in range(n):
		if i % 2 == 0:
			res[i] = v
		else:
			res[i] = x
			x += 1
	return res
for _ in range(INT()):
	(N, l, r) = MAP()
	l -= 1
	ans = []
	cur = 0
	v = 1
	incr = (N - 1) * 2
	while cur + incr < l:
		cur += incr
		v += 1
		incr -= 2
	ans = gen_arr(v)
	ans = ans[l - cur:]
	ln = r - l
	v += 1
	while len(ans) < ln:
		ans += gen_arr(v)
		v += 1
	ans = ans[:ln]
	print(*ans)


for nt in range(int(input())):
	(w, a, b) = map(int, input().split())
	if w == 2:
		l = [1, 2, 1]
		print(*l[a - 1:b])
		continue
	k = w
	prev = 0
	for j in range(a, b + 1):
		i = j - prev
		while k > 1:
			if i <= 2 * (k - 1):
				if i % 2:
					print(w - k + 1, end=' ')
				else:
					print(i // 2 + (w - k + 1), end=' ')
				break
			else:
				i -= 2 * (k - 1)
				prev += 2 * (k - 1)
				k -= 1
		if k == 1:
			print(1, end=' ')
	print()


T = int(input())
for _ in range(T):
	(n, left, right) = map(int, input().split())
	l = [0] * n
	l[1] = 2 * n - 2
	for i in range(2, n):
		l[i] = l[i - 1] - 2
	l[-1] += 1
	left_n = -1
	right_n = -1
	acc = 0
	for i in range(1, n):
		if acc + 1 <= left:
			left_n = i
		acc += l[i]
		if right <= acc:
			right_n = i
			break
	ans = []
	for i in range(left_n, right_n + 1):
		now = []
		for j in range(l[i]):
			if j % 2 == 0:
				now.append(i)
			elif j == 1:
				now.append(i + 1)
			else:
				now.append(now[-2] + 1)
		if i == n - 1:
			now[-1] = 1
		ans += now
	sta = left - sum(l[:left_n]) - 1
	print(*ans[sta:sta + right - left + 1])


import os, sys
from io import BytesIO, IOBase

def solve(n, l, r):
	(fir, st) = (0, 1)
	while st < n:
		x = 2 * (n - st)
		if fir + x >= l:
			break
		fir += x
		st += 1
	if st == n:
		return [1]
	ans = []
	for z in range(st + 1, n + 1):
		ans.append(st)
		ans.append(z)
	st += 1
	while len(ans) < r - fir:
		if st == n:
			ans.append(1)
		else:
			for z in range(st + 1, n + 1):
				ans.append(st)
				ans.append(z)
		st += 1
	return ans[l - fir - 1:r - fir]

def main():
	for _ in range(int(input())):
		(n, l, r) = map(int, input().split())
		print(*solve(n, l, r))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math

def task_1343_c():
	b = int(input())
	array = [int(num) for num in input().split()]
	maxPositive = 0
	minNegative = -10000000000
	res = 0
	for i in range(b):
		if array[i] < 0:
			if i != 0 and array[i - 1] >= 0:
				res += maxPositive
				maxPositive = 0
			minNegative = max(minNegative, array[i])
		elif i != 0 and array[i - 1] < 0:
			res += minNegative
			minNegative = -10000000000
		maxPositive = max(maxPositive, array[i])
	if minNegative == -10000000000:
		res += maxPositive
	else:
		res += maxPositive + minNegative
	print(res)

def task_1341_b():
	(heightLen, doorSize) = map(int, input().split())
	heights = [int(num) for num in input().split()]
	perf = [0 for i in range(heightLen)]
	a = 0
	for i in range(heightLen - 1):
		if i == 0:
			perf[i] = 0
		else:
			if heights[i - 1] < heights[i] and heights[i] > heights[i + 1]:
				a += 1
			perf[i] = a
	perf[heightLen - 1] = a
	max_global = 0
	left_global = 0
	for i in range(heightLen - doorSize):
		max_local = perf[i + doorSize - 1] - perf[i]
		if max_local > max_global:
			max_global = max_local
			left_global = i
	print(max_global + 1, left_global + 1)

def task_1340_a():
	n = int(input())
	array = [int(i) for i in input().split()]
	for i in range(n - 1):
		if array[i] < array[i + 1]:
			if array[i] + 1 != array[i + 1]:
				print('No')
				return
	print('Yes')

def task_1339_b():
	n = int(input())
	array = [int(num) for num in input().split()]
	array.sort()
	output = [0 for i in range(0, n)]
	i = 0
	h = 0
	j = n - 1
	while i <= j:
		output[h] = array[i]
		h += 1
		i += 1
		if h < n:
			output[h] = array[j]
			h += 1
			j -= 1
	for val in reversed(output):
		print(val, end=' ')

def task_1338_a():
	n = int(input())
	inputArr = [int(num) for num in input().split()]
	max_sec = 0
	for i in range(1, n):
		local_sec = 0
		a = inputArr[i - 1] - inputArr[i]
		if a <= 0:
			continue
		else:
			b = math.floor(math.log2(a))
			local_sec = b + 1
			for j in range(b, -1, -1):
				if a < pow(2, j):
					continue
				inputArr[i] += pow(2, j)
				a -= pow(2, j)
			if local_sec > max_sec:
				max_sec = local_sec
	print(max_sec)

def task_1334_d():
	(n, l, r) = map(int, input().split())
	res = []
	count = 0
	start_pos = l
	for i in range(1, n + 1):
		count += (n - i) * 2
		if count >= l:
			for j in range(n - i):
				res.append(i)
				res.append(j + i + 1)
		else:
			start_pos -= (n - i) * 2
		if count >= r:
			break
	res.append(1)
	for i in range(start_pos - 1, start_pos + (r - l)):
		print(res[i], end=' ')
	print()
a = int(input())
for i in range(a):
	task_1334_d()


def oracle(n, start, end):
	nod = 0
	t = n - 1
	ii = 0
	while start - ii > t * 2:
		if t == 0:
			nod += 1
			break
		nod += 1
		ii += t * 2
		t -= 1
		if t < -10:
			import sys
			sys.exit()
	R = []
	for cur in range(nod, n):
		for v in range(cur + 1, n):
			ii += 1
			if start <= ii <= end:
				R.append(cur + 1)
			ii += 1
			if start <= ii <= end:
				R.append(v + 1)
			if ii > end:
				return R
	ii += 1
	if start <= ii <= end:
		R.append(1)
	return R
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	x = oracle(a, b, c)
	print(*x)


def genGroup(lo, n):
	if lo == n:
		return [1]
	s = []
	for i in range(lo + 1, n + 1):
		s.append(lo)
		s.append(i)
	return s
for tc in range(int(input())):
	(n, beg, end) = map(int, input().split())
	if beg == n * (n - 1) + 1:
		print(1)
	else:
		past = 0
		i = 1
		while past + 2 * (n - i) < beg:
			past += 2 * (n - i)
			i += 1
		group = i
		s = genGroup(group, n)
		pos = beg - past - 1
		res = []
		for i in range(end - beg + 1):
			res.append(s[pos])
			pos += 1
			if pos == len(s):
				pos = 0
				group += 1
				s = genGroup(group, n)
		print(*res)


from sys import stdin
input = stdin.readline
for ti in range(int(input().strip())):
	(n, l, r) = [int(x) for x in input().strip().split()]
	(cs, tc, cc) = (1, 0, n - 1)
	ans = []
	while tc + 2 * cc < l and cs <= n:
		tc += 2 * cc
		cs += 1
		cc -= 1
	while tc <= r and cs <= n:
		for cci in range(cs + 1, n + 1):
			ne = cs
			tc += 1
			if l <= tc <= r:
				ans.append(ne)
			ne = cci
			tc += 1
			if l <= tc <= r:
				ans.append(ne)
			if tc > r:
				break
		cs += 1
		cc -= 1
	if tc < r:
		ans.append(1)
	print(*ans)


for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	x = 0
	off = 0
	for i in range(1, n + 1):
		if x + 2 * (n - i) >= l:
			off = l - x - 1
			break
		x += 2 * (n - i)
	series = []
	while len(series) < r - l + 1 + off:
		for j in range(i + 1, n + 1):
			series.append(i)
			series.append(j)
		i += 1
		if i >= n:
			series.append(1)
			break
	print(' '.join(list(map(str, series[off:off + r - l + 1]))))


t = int(input())
for case_num in range(t):
	(n, l, r) = map(int, input().split(' '))
	if l == n * (n - 1) + 1:
		print(1)
		continue
	total = 0
	unvisited = n - 1
	while total < l:
		total += unvisited * 2
		unvisited -= 1
	unvisited += 1
	total -= unvisited * 2
	current = n - unvisited
	nxt = current + 1
	ans = []
	while total < r:
		total += 1
		now = current if total % 2 == 1 else nxt
		if now == nxt:
			nxt += 1
			if nxt > n:
				current += 1
				nxt = current + 1
				if current == n:
					current = 1
		if total >= l:
			ans.append(now)
	print(' '.join(map(str, ans)))


import sys
readline = sys.stdin.readline

def overlap(a, b, c, d):
	if b <= c or d <= a:
		return False
	return True
T = int(readline())
Ans = [None] * T
for qu in range(T):
	(N, l, r) = map(int, readline().split())
	l -= 1
	ans = []
	num = [0] + [2 * (N - i - 1) for i in range(N - 1)] + [1]
	for i in range(1, N + 1):
		num[i] += num[i - 1]
	started = False
	ended = False
	for j in range(N):
		xp = num[j]
		xn = num[j + 1]
		if overlap(xp, xn, l, r):
			started = True
		if started:
			cnt = j + 2
			for k in range(2 * (N - j - 1)):
				if xp + k + 1 <= l:
					if k & 1:
						cnt += 1
					continue
				if xp + k + 1 <= r:
					if k % 2 == 0:
						ans.append(j + 1)
					else:
						ans.append(cnt)
						cnt += 1
				else:
					ended = True
					break
		if ended:
			break
	if r == N * (N - 1) + 1:
		ans.append(1)
	Ans[qu] = ' '.join(map(str, ans))
print('\n'.join(map(str, Ans)))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def solve():
	(n, l, r) = [int(s) for s in input().strip().split()]
	if l == n * (n - 1) + 1:
		print(1)
		return
	i = 1
	cnt = 0
	while l > cnt + (n - i) * 2:
		cnt += (n - i) * 2
		i += 1
	A = []
	while r > cnt + len(A):
		if i == n:
			A.append(1)
		else:
			A.extend([x for j in range(i + 1, n + 1) for x in [i, j]])
		i += 1
	result = A[l - cnt - 1:r - cnt]
	print(' '.join((str(x) for x in result)))

def main():
	for _ in range(int(input().strip())):
		solve()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	begin = 1
	while l > (n - begin) * 2 + 1:
		if begin == n:
			break
		l -= (n - begin) * 2
		r -= (n - begin) * 2
		begin += 1
	if begin == n:
		ans = [n, 1]
	else:
		ans = []
		while len(ans) <= r:
			if begin == n:
				ans.append(1)
				break
			for j in range(begin + 1, n + 1):
				ans.append(begin)
				ans.append(j)
			begin += 1
	print(*ans[l - 1:r])


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(n, l, r) = R()
	if l == r == (n - 1) * n + 1:
		print(1)
		continue
	p = 0
	for i in range(n - 1, 0, -1):
		p += i * 2
		if p >= l:
			k = n - i
			if l % 2 == 0:
				x = n - i + (l - (p - i * 2)) // 2
				print(x, end=' ')
				l += 1
				j = x + 1
				if x == n:
					k += 1
					j = k + 1
			else:
				j = n - i + (l + 1 - (p - i * 2)) // 2
			for i in range(r - l + 1):
				if i % 2:
					print(j, end=' ')
					if j == n:
						j = k + 1
						k += 1
					j += 1
				elif k != n:
					print(k, end=' ')
				else:
					print(1, end=' ')
			break
	print()


def f(n, k):
	return n * k - k + n * k - k * k

def af(n, p):
	if p == n * (n - 1):
		return 1
	l = 0
	r = n + 1
	while r - l > 1:
		m = (l + r) // 2
		if f(n, m) <= p:
			l = m
		else:
			r = m
	if (p - f(n, l)) % 2 == 0:
		return r
	return (p - f(n, l) + 1) // 2 + r
t = int(input())
for i in range(t):
	(n, l, r) = map(int, input().split())
	z = []
	for j in range(l - 1, r):
		z.append(af(n, j))
	print(*z)


import sys
d = []

def bins(k, n):
	l = 0
	r = n - 2
	while l != r:
		mid = (l + r + 1) // 2
		if d[mid] <= k:
			l = mid
		else:
			r = mid - 1
	ex = k - d[l]
	if ex & 1:
		f = ex // 2
		return f + l + 2
	else:
		return l + 1
for q in range(int(sys.stdin.readline())):
	(n, l, r) = [int(j) for j in sys.stdin.readline().split()]
	mx = n * (n - 1)
	d = [0] * (n - 1)
	for i in range(1, n - 1):
		d[i] = d[i - 1] + 2 * (n - i)
	ret = []
	for i in range(l - 1, r):
		ret.append(str(bins(0 if i == mx else i, n)))
	sys.stdout.write(' '.join(ret) + '\n')


from sys import stdin
input = stdin.readline
q = int(input())
for _ in range(q):
	(n, l, r) = map(int, input().split())
	tab = [-1, 1]
	cyk = 0
	for i in range(n):
		cyk += 2 * (n - i - 1)
		tab.append(cyk + 1)
	tab.append(1012809128301279797787789798789798798)
	i = 0
	start = i
	while True:
		if tab[i + 1] > l:
			start = i
			break
		else:
			i += 1
	ind = l
	dlug = 0
	koniec = 0
	while True:
		if koniec:
			break
		target = tab[start + 1]
		while ind < target:
			if koniec:
				break
			if ind == n * (n - 1) + 1:
				print(1, end=' ')
				dlug += 1
			else:
				dlug += 1
				if ind % 2 == 1:
					print(i, end=' ')
				else:
					print(n - (target - ind - 1) // 2, end=' ')
				ind += 1
			if dlug >= r - l + 1:
				koniec = 1
		start += 1
		i += 1
	print()


for t in range(int(input())):
	(n, l, r) = map(int, input().split())
	b = 1
	for i in range(1, n):
		a = b
		b += 2 * (n - i)
		if l < b:
			break
	(x, y) = (i, (l - a) // 2 + i + 1)
	b = (l - a) % 2
	for _ in range(r - l):
		if b:
			print(y, end=' ')
			y += 1
			if y == n + 1:
				x += 1
				y = x + 1
		else:
			print(x, end=' ')
		b ^= 1
	if r == n * (n - 1) + 1:
		print(1)
	else:
		print(y if b else x)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, l, r) = map(int, sys.stdin.readline().split())
	prev = 0
	cur = 0
	start = 1
	if l == r and l == n * (n - 1) + 1:
		print(1)
	else:
		ans = []
		while True:
			cur += (n - start) * 2
			if l <= cur:
				pos = l - prev
				total = r - l + 1
				if pos % 2 == 1:
					ans.append(start)
					total -= 1
					x = start + pos // 2 + 1
					while total > 0:
						ans.append(x)
						if x == n:
							start += 1
							if start == n:
								start = 1
							x = start
						total -= 1
						if total > 0:
							ans.append(start)
							total -= 1
							x += 1
				else:
					x = start + pos // 2
					while total > 0:
						ans.append(x)
						if x == n:
							start += 1
							if start == n:
								start = 1
							x = start
						total -= 1
						if total > 0:
							ans.append(start)
							total -= 1
							x += 1
				break
			prev = cur
			start += 1
		print(*ans)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(n, l, r) = mapi()
	low = 1
	high = n - 1
	pst = 0

	def check(pst, n, l):
		val = 2 * n * pst - pst * pst - pst
		if val < l:
			return True
		return False
	while low <= high:
		mid = (low + high) // 2
		if check(mid, n, l):
			pst = mid
			low = mid + 1
		else:
			high = mid - 1
	val = 2 * n * pst - pst * pst - pst
	rem = l - val
	temp = True
	prev = True
	for i in range(rem - 1):
		if prev:
			if temp:
				pst += 1
				nxt = pst
		else:
			nxt += 1
			temp = False
		if nxt == n:
			temp = True
		prev = not prev
	res = []
	for i in range(r - l + 1):
		if prev:
			if temp:
				pst += 1
				nxt = pst
			if pst == n:
				pst = 1
			res.append(pst)
		else:
			temp = False
			nxt += 1
			res.append(nxt)
		if nxt == n:
			temp = True
		prev = not prev
	print(*res)


import os
import sys
from io import BytesIO, IOBase
from math import floor, sqrt

def main():
	for _ in range(int(input())):
		(n, l, r) = map(int, input().split())
		if l == n * (n - 1) + 1:
			print(1)
			continue
		i = 1
		cnt = 0
		while l > cnt + (n - i) * 2:
			cnt += (n - i) * 2
			i += 1
		A = []
		while r > cnt + len(A):
			if i == n:
				A.append(1)
			else:
				A.extend([x for j in range(i + 1, n + 1) for x in [i, j]])
			i += 1
		result = A[l - cnt - 1:r - cnt]
		print(' '.join((str(x) for x in result)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def slv(n, l, r):
	l -= 1
	r -= 1
	c = 0
	ans = []
	for i in range(1, n):
		(nl, nr) = (c, c + 2 * (n - i) - 1)
		c = nr + 1
		if l > nr:
			continue
		for j in range(max(l, nl), min(r, nr) + 1):
			if j % 2 == 0:
				ans.append(i)
			else:
				ans.append(i + (j - nl + 1) // 2)
	if r == n * (n - 1):
		ans.append(1)
	print(' '.join([str(i) for i in ans]))
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	slv(n, l, r)


from sys import *
t = int(stdin.readline())
import math
for _ in range(t):
	(n, l, r) = list(map(int, stdin.readline().split(' ')))
	if l == n * n - n + 1:
		print('1')
		continue
	k = math.ceil((2 * n - 1 - math.sqrt((2 * n - 1) ** 2 - 4 * l)) / 2)
	s = k * (2 * n - 1 - k)
	sl = 2 * (n - k)
	lb = k
	eb = k + 1 + math.ceil((l - s + sl) / 2) - 1
	while l <= r:
		if l == n * n - n + 1:
			break
		if l % 2 == 0:
			stdout.write(str(eb) + ' ')
			eb = eb + 1
			if eb > n:
				lb = lb + 1
				eb = lb + 1
		else:
			stdout.write(str(lb) + ' ')
		l = l + 1
	if r == n * n - n + 1:
		stdout.write('1')
	stdout.write('\n')


import sys
input = sys.stdin.readline
T = int(input())
for tests in range(T):
	(n, l, r) = map(int, input().split())
	begin = 1
	while l > (n - begin) * 2 + 1:
		if begin == n:
			break
		l -= (n - begin) * 2
		r -= (n - begin) * 2
		begin += 1
	if begin == n:
		ANS = [n, 1]
	else:
		ANS = []
		while len(ANS) <= r:
			if begin == n:
				ANS.append(1)
				break
			for j in range(begin + 1, n + 1):
				ANS.append(begin)
				ANS.append(j)
			begin += 1
	print(*ANS[l - 1:r])


t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	l -= 1
	r -= 1
	start_i = 1
	pos = 0
	while start_i < n:
		cur_i_len = 2 * (n - start_i)
		if pos + cur_i_len > l:
			break
		pos += cur_i_len
		start_i += 1
	wanted_len = r - l + 1
	s = []
	while len(s) < l - pos + wanted_len:
		if start_i < n:
			for i in range(start_i + 1, n + 1):
				s += [str(start_i), str(i)]
		else:
			s += ['1']
		start_i += 1
	print(*s[l - pos:l - pos + wanted_len])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
for _ in range(int(ri())):
	(n, l, r) = Ri()
	l -= 1
	r -= 1
	cnt = r - l + 1
	i = 0
	flag = False
	for i in range(n):
		if l > 2 * (n - i - 1):
			l -= (n - i - 1) * 2
		else:
			flag = True
			break
	if flag:
		ans = []
		sta = -1
		nex = -1
		if l % 2 == 1:
			ans.append(i + l // 2 + 1)
			cnt -= 1
			sta = i
			nex = i + l // 2 + 2
		else:
			sta = i
			nex = i + l // 2 + 1
		if nex >= n:
			sta += 1
			nex = sta + 1
		if sta >= n - 1:
			ans.append(0)
			cnt = 0
		while cnt > 0:
			ans.append(sta)
			cnt -= 1
			if cnt > 0:
				ans.append(nex)
				cnt -= 1
			if cnt == 0:
				break
			nex += 1
			if nex >= n:
				sta += 1
				nex = sta + 1
			if sta >= n - 1:
				ans.append(0)
				cnt = 0
		ans = [i + 1 for i in ans]
		print(*ans)


import sys

def data():
	return sys.stdin.buffer.readline().strip()
out = sys.stdout.write

def mdata():
	return map(int, data().split())
for t in range(int(data())):
	(n, l, r) = mdata()
	a = l
	for i in range(1, n + 1):
		if 2 * (n - i) <= a:
			a -= 2 * (n - i)
		else:
			break
	cnt = l
	ans = []
	if l % 2 == 0:
		if a == 0:
			ans.append(str(n))
		else:
			ans.append(str(i + a // 2))
		cnt += 1
	k = i + a // 2 + 1
	for j in range(i, n):
		while cnt <= r:
			ans.append(str(j))
			cnt += 1
			if cnt > r:
				break
			ans.append(str(k))
			k += 1
			cnt += 1
			if k == n + 1:
				k = j + 2
				break
	if r == n * (n - 1) + 1:
		ans.append(str(1))
	out(' '.join(ans) + '\n')


t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	L = [0]
	tt = 2 * (n - 1)
	for i in range(n):
		L.append(tt)
		tt -= 2
	L[-1] = 1
	temp = 0
	ct = r - l + 1
	c = 0
	tot = 0
	for i in range(1, len(L)):
		if tot + L[i] < l:
			tot += L[i]
		else:
			rem = l - tot
			p1 = i
			p2 = rem // 2
			if rem % 2 != 0:
				p2 += 1
				temp = 1
			p2 += i
			break
	if temp == 0:
		print(p2, end=' ')
		p2 += 1
		if p2 == n + 1:
			p1 += 1
			if p1 == n:
				p1 = 1
			p2 = p1 + 1
		c += 1
	if p1 == n:
		p1 = 1
	while c < ct:
		print(p1, end=' ')
		c += 1
		if c == ct:
			break
		print(p2, end=' ')
		c += 1
		p2 += 1
		if p2 == n + 1:
			p1 += 1
			if p1 == n:
				p1 = 1
			p2 = p1 + 1
	print(' ')


def check(x, n, l):
	val = 2 * n * x - x * x - x
	if val < l:
		return True
	return False

def solve(n, l, r, ans):
	low = 1
	high = n - 1
	x = 0
	while low <= high:
		mid = (low + high) // 2
		if check(mid, n, l):
			x = mid
			low = mid + 1
		else:
			high = mid - 1
	val = 2 * n * x - x * x - x
	rem = l - val
	temp = True
	prev = True
	for i in range(rem - 1):
		if prev:
			if temp:
				x += 1
				y = x
		else:
			y += 1
			temp = False
		if y == n:
			temp = True
		prev = not prev
	arr = []
	for i in range(r - l + 1):
		if prev:
			if temp:
				x += 1
				y = x
			if x == n:
				x = 1
			arr.append(x)
		else:
			temp = False
			y += 1
			arr.append(y)
		if y == n:
			temp = True
		prev = not prev
	ans.append(arr)

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(n, l, r) = map(int, input().split())
		solve(n, l, r, ans)
	for i in ans:
		for j in i:
			print(j, end=' ')
		print()
main()


def solve():
	(n, l, r) = map(int, input().split())

	def where(x):
		if x == n * (n - 1) + 1:
			return 1
		else:
			l = 0
			r = n + 1
			while r - l > 1:
				m = (l + r) // 2
				if (2 * n - 1 - m) * m < x:
					l = m
				else:
					r = m
			v = x - (2 * n - 1 - l) * l
			if v % 2 != 0:
				return r
			else:
				return r + v // 2
	res = [where(p) for p in range(l, r + 1)]
	print(*res)
	return

def main():
	t = int(input())
	for i in range(t):
		solve()
main()


cases = int(input())

def ecycle(n, l, r):
	l -= 1
	cnt = r - l
	p = n - 1
	start = 1
	while l >= 2 * p and p > 0:
		l -= 2 * p
		p -= 1
		start += 1
	if start == n:
		start = 1
	flag = (l + 1) % 2
	nextn = start + 1 + l // 2
	while cnt > 0:
		cnt -= 1
		if flag == 1:
			print(start, end=' ')
		if flag == 0:
			print(nextn, end=' ')
			nextn += 1
		if nextn > n:
			start += 1
			nextn = start + 1
			flag = 0
			if start == n:
				start = 1
		flag = 1 - flag
while cases > 0:
	(n, l, r) = map(int, input().split())
	ecycle(n, l, r)
	cases -= 1


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def stupid(x, n):
	k = (n - 1) * 2
	r = 0
	while x >= k:
		x -= k
		r += 1
		k -= 2
	return r

def findl(x, n):
	(l, r) = (0, n)
	while r - l > 1:
		c = (l + r) // 2
		if (2 * n - 1 - c) * c <= x:
			l = c
		else:
			r = c
	return l

def solve():
	(n, l, r) = mints()
	res = []
	f = r == n * (n - 1) + 1
	r -= l + f - 1
	l -= 1
	x = findl(l, n)
	l -= (2 * n - 1 - x) * x
	k = (n - 1 - x) * 2
	x += 1
	while False:
		print(l, k)
		l -= k
		x += 1
		k -= 2
	y = x + 1 + l // 2
	if l % 2:
		while r >= 2:
			res.append(y)
			if y == n:
				x += 1
				y = x + 1
			else:
				y += 1
			res.append(x)
			r -= 2
		if r != 0:
			res.append(y)
	else:
		while r >= 2:
			res.append(x)
			res.append(y)
			if y == n:
				x += 1
				y = x + 1
			else:
				y += 1
			r -= 2
		if r != 0:
			res.append(x)
	if f:
		res.append(1)
	print(' '.join(map(str, res)))
for i in range(mint()):
	solve()


import sys
from collections import defaultdict
from copy import copy
R = lambda t=int: t(input())
RL = lambda t=int: [t(x) for x in input().split()]
RLL = lambda n, t=int: [RL(t) for _ in range(n)]

def solve():
	(n, l, r) = RL()
	if l == n * (n - 1) + 1:
		print(1)
		return
	l -= 1
	r -= 1
	D = ((2 * n - 1) ** 2 - 4 * l) ** 0.5
	a = (2 * n - 1 - D) / 2
	a = int(a)
	x = a * (n - 1 + (n - a))
	l -= x
	r -= x
	i = 0
	s = []
	a += 1
	b = a + 1
	while i <= r and a < n:
		s += [str(a), str(b)]
		b += 1
		if b > n:
			a += 1
			b = a + 1
		i += 2
	s += '1'
	for c in s[l:r + 1]:
		print(str(c), end=' ')
	print()
T = R()
for _ in range(T):
	solve()


from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def generateForStartVertex(startVertex, n):
	if startVertex == n:
		return [1]
	res = []
	other = startVertex + 1
	while other <= n:
		res.append(startVertex)
		res.append(other)
		other += 1
	return res

@bootstrap
def calc(l, r, startVertex, startIndex, n, res):
	nextStartIndex = startIndex + 2 * (n - startVertex)
	if startVertex == n:
		nextStartIndex += 1
	currIdx = startIndex
	if l < nextStartIndex:
		for x in generateForStartVertex(startVertex, n):
			if l <= currIdx <= r:
				res.append(x)
			currIdx += 1
	if startVertex + 1 <= n and r >= nextStartIndex:
		yield calc(l, r, startVertex + 1, nextStartIndex, n, res)
	yield res

def main():
	t = int(input())
	allans = []
	for _ in range(t):
		(n, l, r) = readIntArr()
		res = []
		calc(l, r, 1, 1, n, res)
		allans.append(res)
	multiLineArrayOfArraysPrint(allans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(n, l, r) = li()
	orig = r
	l -= 1
	r -= l
	currleft = 0
	curs = n - 1
	while curs and currleft + 2 * curs <= l:
		currleft += 2 * curs
		curs -= 1
	start = n - curs
	ans = []
	head = start
	l -= currleft
	last = head + 1
	half = 0
	while l:
		half = 1
		start = last
		last += 1
		l -= 1
		if not l:
			break
		half = 0
		start = head
		l -= 1
	if half:
		ans.append(start)
		if last == n + 1:
			head += 1
			last = head + 1
		start = head
		r -= 1
	while r:
		ans.append(start)
		r -= 1
		if not r:
			break
		start = last
		ans.append(start)
		last += 1
		if last == n + 1:
			head += 1
			last = head + 1
		r -= 1
		start = head
	if orig == n * (n - 1) + 1:
		ans[-1] = 1
	print(*ans)


import itertools as it
import os

def items(k, n):
	return 2 * k * n - k * (k + 1)

def b(l, n):
	if l > n * (n - 1):
		return n
	low = 1
	high = n - 1
	while low < high:
		mid = (high + low) // 2
		if items(mid, n) < l:
			low = mid + 1
		else:
			high = mid
	return low

def row_gen(r, n):
	while r <= n:
		if r == n:
			yield 1
		else:
			x = r
			a = False
			while x < n:
				a = not a
				if a:
					yield r
				else:
					x += 1
					yield x
		r += 1

def get_seg(l, r, n):
	start_row = b(l, n)
	count_r = l - items(start_row - 1, n)
	g = row_gen(start_row, n)
	return it.islice(g, count_r - 1, count_r + r - l)

def pp(input):
	T = int(input())
	for i in range(T):
		(n, l, r) = map(int, input().split())
		print(' '.join(map(str, get_seg(l, r, n))))
if 'paalto' in os.getcwd():
	from string_source import string_source
	pp(string_source('3\n2 1 3\n3 3 6\n99995 9998900031 9998900031\n'))
else:
	pp(input)


t = int(input())
for ii in range(t):
	(n, l, r) = map(int, input().split())
	s = []
	count = 1
	ans = count * (2 * (n - 1) + 1 - count)
	while n - count > 0 and ans < l:
		count += 1
		ans = count * (2 * (n - 1) + 1 - count)
	count -= 1
	remain = l - count * (2 * (n - 1) + 1 - count) - 1
	val = 0
	b = 0
	for i in range(count, n):
		for j in range(i + 1, n):
			s.append(i + 1)
			s.append(j + 1)
			val += 2
			if val > r - l + remain + 1:
				b = 1
				break
		if b:
			break
	s.append(1)
	q = s[remain:r - l + 1 + remain]
	for i in range(len(q) - 1):
		print(q[i], end=' ')
	print(q[-1])


import sys

def binsearch(i, n):
	last = n * (n - 1)
	ip = n * (n - 1) - i
	jprev = 0
	j = n - 1
	while True:
		step = max(1, abs(jprev - j) // 2)
		jprev = j
		if j * (j - 1) < ip:
			j += step
		elif j > 1 and (j - 1) * (j - 2) >= ip:
			j -= step
		else:
			break
	k = i - (last - j * (j - 1))
	return (j, k)

def segment(n, l, r):
	res = []
	(j1, k1) = binsearch(l - 1, n)
	(j2, k2) = binsearch(r - 1, n)
	for j in range(j1, j2 - 1, -1):
		for k in range(2 * (j - 1)):
			if not (j == j1 and k < k1) and (not (j == j2 and k > k2)):
				if k % 2 == 0:
					res.append(n - j + 1)
				else:
					res.append(k // 2 + n - j + 2)
	if j2 == 1 and k2 == 0:
		res.append(1)
	return res
t = int(input().strip())
for _ in range(t):
	(n, l, r) = list(map(int, input().strip().split()))
	print(' '.join(map(str, segment(n, l, r))))


import os
import sys
from io import BytesIO, IOBase
INF = 2 ** 62 - 1
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def slv(N, L, R):
	k = 1
	ans = []
	for i in range(N - 1):
		c = (N - 1 - i) * 2
		if k + c >= L:
			for j in range(c // 2):
				if L <= k <= R:
					ans.append(i + 1)
				k += 1
				if L <= k <= R:
					ans.append(i + 1 + j + 1)
				k += 1
				if k > R:
					return ans
		else:
			k += c
	if L <= k <= R:
		ans.append(1)
	return ans

def main():
	T = read_int()
	for _ in range(T):
		(N, L, R) = read_int_n()
		print(*slv(N, L, R))
main()


import sys
input = sys.stdin.readline
from collections import *

def binary_search1():
	(l, r) = (1, n - 1)
	while l <= r:
		m = (l + r) // 2
		if acc[m] - acc[1] + 1 <= left:
			l = m + 1
		else:
			r = m - 1
	return r

def binary_search2():
	(l, r) = (1, n - 1)
	while l <= r:
		m = (l + r) // 2
		if acc[m + 1] - acc[1] >= right:
			r = m - 1
		else:
			l = m + 1
	return l
T = int(input())
for _ in range(T):
	(n, left, right) = map(int, input().split())
	l = [0, 2 * n - 2]
	for _ in range(n - 2):
		l.append(l[-1] - 2)
	l[-1] += 1
	acc = [0]
	for li in l:
		acc.append(acc[-1] + li)
	left_n = binary_search1()
	right_n = binary_search2()
	ans = []
	for i in range(left_n, right_n + 1):
		li = []
		for j in range(l[i] - 1):
			if j % 2 == 0:
				li.append(i)
			elif j == 1:
				li.append(i + 1)
			else:
				li.append(li[-2] + 1)
		if i == n - 1:
			li.append(1)
		else:
			li.append(n)
		ans += li
	sta = left - (acc[left_n] - acc[1]) - 1
	print(*ans[sta:sta + right - left + 1])


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def solve(n):
	return n * (n + 1) // 2
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	if 2 * n * n - n * (n + 1) + 1 == l:
		print(1)
		continue
	z_1 = 2 * n - 1 + sqrt((2 * n - 1) ** 2 - 4 * l)
	z_2 = 2 * n - 1 - sqrt((2 * n - 1) ** 2 - 4 * l)
	z1 = ceil(min(z_1, z_2) / 2)
	z0 = z1 - 1
	la = l
	l -= 2 * z0 * n - z0 * (z0 + 1)
	ans = []
	if l % 2 == 0:
		k1 = l // 2
		l = la
	else:
		ans.append(int(z1))
		k1 = (l + 1) // 2
		l = la
		if r - l + 1 == len(ans):
			print(*ans)
			continue
		l += 1
	ha = z1 + 1 + (k1 - 1)
	ans.append(int(ha))
	l += 1
	cnt = max(ans) + 1
	while l != r + 1:
		if ans[-1] == n:
			z1 += 1
			cnt = z1 + 1
			if z1 == n + 1 or z1 == n:
				ans.append(1)
				break
			else:
				ans.append(int(z1))
		elif l % 2 != 0:
			ans.append(int(z1))
		else:
			ans.append(int(cnt))
			cnt += 1
		l += 1
	print(*ans)


def ss(a, d, n):
	return n * (2 * a + (n - 1) * d) // 2
T = int(input())
for loop in range(T):
	(n, l, r) = map(int, input().split())
	ans = []
	lb = 0
	rb = n - 1
	while rb - lb != 1:
		m = (lb + rb) // 2
		if ss(2 * n - 2, -2, m) >= l:
			rb = m
		else:
			lb = m
	BB = rb
	ind = ss(2 * n - 2, -2, rb - 1) + 1
	inind = BB + 1
	state = 0
	while ind <= r:
		now = 0
		if state == 0:
			now = BB
			state = 1
		else:
			now = inind
			inind += 1
			state = 0
			if inind == n + 1:
				BB += 1
				inind = BB + 1
		if ind == ss(2 * n - 2, -2, n - 1) + 1:
			ans.append(1)
			break
		if ind >= l:
			ans.append(now)
		ind += 1
	print(*ans)


for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	z = 0
	idx = 0
	sd = (n - 1) * 2
	lst = n * (n - 1) + 1
	while z < l:
		if sd <= 0:
			z += 1
			break
		idx += 1
		z += sd
		sd -= 2
	m = idx - 1
	c = (n - 1) * 2
	sm = 0
	for t in range(m):
		sm += c
		c -= 2
	sm += 1
	nikal = l - sm
	p = []
	if idx == 1:
		for t in range(2, n + 1):
			p.append(1)
			p.append(t)
	else:
		ii = idx
		for t in range(ii + 1, n + 1):
			p.append(ii)
			p.append(t)
	p.reverse()
	for tg in range(nikal):
		p.pop()
	p.reverse()
	idx += 1
	i1 = idx
	while len(p) < r - l + 1:
		if i1 == n:
			p.append(1)
		for t in range(i1 + 1, n + 1):
			p.append(i1)
			p.append(t)
		i1 += 1
	print(*p[:r - l + 1])


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
res = ['YES', 'NO']
for _ in range(ii()):
	(n, l, r) = mi()
	if l == n * (n - 1) + 1:
		print(1)
		continue
	(x, p) = (1, n * 2)
	while x <= l:
		p -= 2
		x += p
	x -= p
	p = n * 2 - p
	p //= 2
	a = []
	dl = l - x + 1
	z = p + (dl + 1) // 2
	if not dl % 2:
		a.append(z)
		l += 1
		z += 1
		if z > n:
			p += 1
			z = p + 1
	while l <= r:
		a.append(p)
		l += 1
		if l <= r:
			a.append(z)
			l += 1
			z += 1
			if z > n:
				p += 1
				z = p + 1
	if r == n * (n - 1) + 1:
		a[-1] = 1
	print(*a)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def query(n, l, r):
	begin = 1
	while l > (n - begin) * 2 + 1:
		if begin == n:
			break
		l -= (n - begin) * 2
		r -= (n - begin) * 2
		begin += 1
	Ans = []
	ans_l = 0
	while ans_l <= r:
		if begin == n:
			Ans.append(1)
			break
		for j in range(begin + 1, n + 1):
			Ans.append(begin)
			Ans.append(j)
		ans_l += (n - begin) * 2
		begin += 1
	return Ans[l - 1:r]

def main():
	t = int(input())
	for _ in range(t):
		(n, l, r) = map(int, input().split())
		Ans = query(n, l, r)
		sys.stdout.write(' '.join(map(str, Ans)) + '\n')
main()


import sys
input = sys.stdin.readline

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def val():
	return int(input().rstrip('\n'))
for _ in range(val()):
	(n, l, r) = li()
	orig = r
	l -= 1
	r -= l
	currleft = 0
	curs = n - 1
	while curs and currleft + 2 * curs <= l:
		currleft += 2 * curs
		curs -= 1
	start = n - curs
	ans = []
	head = start
	l -= currleft
	last = head + 1
	half = 0
	while l:
		half = 1
		start = last
		last += 1
		l -= 1
		if not l:
			break
		half = 0
		start = head
		l -= 1
	if half:
		ans.append(start)
		if last == n + 1:
			head += 1
			last = head + 1
		start = head
		r -= 1
	while r:
		ans.append(start)
		r -= 1
		if not r:
			break
		start = last
		ans.append(start)
		last += 1
		if last == n + 1:
			head += 1
			last = head + 1
		r -= 1
		start = head
	if orig == n * (n - 1) + 1:
		ans[-1] = 1
	print(*ans)


def calcStartIndex(vertex, n):
	i = vertex
	return 1 + 2 * (i - 1) * n - i * i + i

def main():
	t = int(input())
	allans = []
	for _ in range(t):
		(n, l, r) = readIntArr()
		startVertex = 1
		b = n
		while b > 0:
			while startVertex + b <= n and calcStartIndex(startVertex + b, n) <= l:
				startVertex += b
			b //= 2
		sv = startVertex
		idx = calcStartIndex(sv, n)
		ans = []
		adder = 1
		addTurn = False
		while idx <= r:
			if addTurn:
				curr = sv + adder
				adder += 1
			else:
				curr = sv
			if idx >= l:
				if sv < n:
					ans.append(curr)
				else:
					ans.append(1)
			addTurn = not addTurn
			idx += 1
			if curr == n:
				sv += 1
				adder = 1
				addTurn = False
		allans.append(ans)
	multiLineArrayOfArraysPrint(allans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


from sys import stdin, gettrace
from math import sqrt
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, l, r) = map(int, input().split())
		lv = int((2 * n + 1 - sqrt((2 * n - 1) ** 2 - 4 * (l - 1))) / 2)
		lvs = -2 * n + 2 * n * lv - lv * lv + lv
		lrd = l - lvs - 1
		res = []
		i = lv
		j = lv + lrd // 2 + 1
		if l % 2 == 0:
			res = [j]
			if j < n:
				j += 1
			else:
				i += 1
				j = i + 1
		for _ in range(l - 1, r, 2):
			res += [i, j]
			if j < n:
				j += 1
			else:
				i += 1
				j = i + 1
		if r == n * (n - 1) + 1:
			res[r - l] = 1
		print(*res[:r - l + 1])
	q = int(input())
	for _ in range(q):
		solve()
main()


t = int(input())
for i in range(t):
	(n, l, r) = map(int, input().split())
	if l == n * (n - 1) + 1:
		print(1)
	else:
		x = 1
		summa = x * 2 * n
		rasn = x * (x + 1)
		while summa - rasn < l:
			summa += 2 * n
			rasn = rasn // x * (x + 2)
			x += 1
		x -= 1
		summa -= 2 * n
		rasn = rasn // (x + 2) * x
		first = x + 1
		second = (l - summa + rasn + 1) // 2 + first
		if (l - summa + rasn) % 2 == 0:
			print(second, end=' ')
			if second == n:
				first += 1
				second = first + 1
			else:
				second += 1
			ind = l + 1
		else:
			ind = l
		while ind + 1 <= r:
			print(first, second, end=' ')
			if second == n:
				first += 1
				second = first + 1
			else:
				second += 1
			ind += 2
		if ind == r:
			if r == n * (n - 1) + 1:
				print(1)
			elif second == n:
				print(first)
			else:
				print(first)
		else:
			print()


import sys
import io, os

def main():
	input = sys.stdin.readline
	t = int(input())
	for i in range(t):
		(n, l, r) = map(int, input().split())
		end = []
		start = (n - 1) * 2
		copy = 0
		(count, ok) = (0, True)
		for i in range(1, n + 1):
			if count + start < l:
				count += start
				copy += start
				start -= 2
			else:
				pq = count
				for j in range(i + 1, n + 1):
					end.append(i)
					end.append(j)
					pq += 2
					count = pq
					if pq >= r:
						ok = False
						break
			if ok == False:
				break
		if r == n * (n - 1) + 1:
			end.append(1)
		ans = ' '.join(map(str, end[l - copy - 1:r - copy]))
		sys.stdout.write(ans + '\n')
main()


from math import floor
T = int(input())
for _ in range(T):
	(n, l, r) = map(int, input().split())
	o_r = r
	ans = []
	if l == n * (n - 1) + 1:
		print(1)
		continue
	i = 1
	while l > 0:
		if l <= 2 * (n - i):
			for j in range(i + 1, n + 1):
				l -= 1
				r -= 1
				if l <= 0 and r >= 0:
					ans.append(i)
				l -= 1
				r -= 1
				if l <= 0 and r >= 0:
					ans.append(j)
		else:
			l -= 2 * (n - i)
			r -= 2 * (n - i)
		i += 1
	while r > 0 and i < n:
		for j in range(i + 1, n + 1):
			r -= 1
			if r >= 0:
				ans.append(i)
			r -= 1
			if r >= 0:
				ans.append(j)
		i += 1
	if r > 0:
		ans.append(1)
	print(' '.join(list(map(str, ans))))


for _ in range(int(input())):
	(numbers, LEFTs, RIGHTs) = map(int, input().split())
	KEYSs = 0
	GREATS = 0
	for i in range(1, numbers + 1):
		if KEYSs + 2 * (numbers - i) >= LEFTs:
			GREATS = LEFTs - KEYSs - 1
			break
		KEYSs += 2 * (numbers - i)
	LISTs = []
	while len(LISTs) < RIGHTs - LEFTs + 1 + GREATS:
		for j in range(i + 1, numbers + 1):
			LISTs.append(i)
			LISTs.append(j)
		i += 1
		if i >= numbers:
			LISTs.append(1)
			break
	print(' '.join(list(map(str, LISTs[GREATS:GREATS + RIGHTs - LEFTs + 1]))))


import math
import sys
T = int(input())
for _ in range(T):
	(n, l, r) = map(int, input().split())
	size = r - l + 1
	run = 0
	ans = []
	for i in range(1, n):
		run += 2 * (n - i)
		if l <= run:
			prev = run - 2 * (n - i)
			gone = l - prev - 1
			size += gone
			cur = 0
			now = i
			nex = i + 1
			flag = True
			while cur < size:
				if flag:
					if gone > 0:
						gone -= 1
					else:
						ans.append(now)
					flag = False
				else:
					if gone > 0:
						gone -= 1
					else:
						ans.append(nex)
					nex += 1
					if nex > n:
						now += 1
						nex = now + 1
					flag = True
				cur += 1
			break
	if len(ans) == 0:
		ans.append(1)
	if r == n * (n - 1) + 1:
		ans[-1] = 1
	print(*ans)


def calc(N, index):
	if index == 1 or index == N * (N - 1) + 1:
		return 1
	else:
		wave_l = 1
		wave_r = N
		while wave_r - wave_l > 1:
			M = (wave_l + wave_r) // 2
			if (2 * N - M) * (M - 1) < index:
				wave_l = M
			else:
				wave_r = M
		wave = wave_l
		Left = index - (2 * N - wave) * (wave - 1)
		if Left % 2 != 0:
			return wave
		else:
			return wave + Left // 2
	Left = index - (cnt - 1) * (cnt - 2)
	if Left % 2 == 0:
		return cnt
	elif cnt != Left // 2 + 1:
		return Left // 2 + 1
	else:
		return 1

def solve():
	(n, l, r) = map(int, input().split())
	A = []
	for i in range(l, r + 1):
		A.append(calc(n, i))
	print(*A)

def main():
	T = int(input())
	for i in range(T):
		solve()
main()


import bisect
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	ans = []
	sums = []
	tmp = 0
	for i in range(n - 1, 0, -1):
		tmp += i
		sums.append(tmp)
	for i in range(l - 1, r):
		if i % 2 == 0:
			k = i // 2
			g = bisect.bisect_right(sums, k)
			tmp = 0
			if g == n - 1:
				ans.append(1)
			else:
				ans.append(g + 1)
		else:
			k = (i - 1) // 2
			g = bisect.bisect_right(sums, k)
			tmp = g * (2 * (n - 1) - (g - 1)) // 2
			ans.append(2 + g + k - tmp)
	print(*ans)


from collections import *
import sys
try:
	inp = raw_input
except:
	inp = input

def err(s):
	sys.stderr.write('{}\n'.format(s))

def ni():
	return int(inp())

def nl():
	return [int(_) for _ in inp().split()]

def solve():
	(n, L, R) = nl()
	L -= 1
	R -= 1
	SM = 0
	out = []
	for i in range(1, n):
		no = (n - i) * 2
		if no + SM <= L:
			SM += no
			continue
		if SM > R:
			continue
		ARR = [i if j % 2 == 0 else i + j // 2 + 1 for j in range(no)]
		start = max(0, L - SM)
		end = R - SM + 1
		out.extend(ARR[start:end])
		SM += no
	if R == SM:
		out.append(1)
	print(' '.join(map(str, out)))
T = ni()
for _ in range(T):
	solve()


import math
import sys
A = 1
B = 1
C = 1
K = 0

def LFromI(I):
	return I * I * A + I * B + C

def IFromL(L):
	return math.floor((-B + math.sqrt(B * B - 4 * A * (C - L))) / (2 * A))

def Out(l, R):
	curint = IFromL(l)
	curpos = LFromI(curint)
	while curpos <= R:
		if curint == K:
			print(1, end=' ')
			break
		for i in range(2 * (K - curint)):
			if curpos + i > R:
				break
			if curpos + i < l:
				continue
			if i % 2 == 0:
				print(curint, end=' ')
			else:
				print(curint + (i + 1) // 2, end=' ')
		curint += 1
		curpos = LFromI(curint)
	return 1
t = int(input())
for _ in range(t):
	(K, l, r) = map(int, input().split())
	A = -1
	B = 2 * K + 1
	C = -2 * K
	Out(l - 1, r - 1)
	print()


for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	s = 0
	ans = []
	for i in range(1, n):
		gap2 = i
		t = i
		if s + (n - i) * 2 >= l:
			for j in range(l, r + 1):
				gg = (j - s) // 2
				if j % 2 == 1:
					ans.append(gap2)
				else:
					ans.append(gap2 + gg)
					if gap2 + gg == n:
						gap2 += 1
						s += (n - t) * 2
						t += 1
			if r == n * (n - 1) + 1:
				ans[-1] = 1
			break
		else:
			s += (n - i) * 2
	if len(ans) == 0:
		print(1)
	else:
		print(*ans)


def main():
	for _ in inputt():
		(n, l, r) = inputi()
		i = 1
		l -= 1
		if l == n * (n - 1):
			print(1)
			continue
		while l >= 2 * (n - i):
			l -= 2 * (n - i)
			r -= 2 * (n - i)
			i += 1
		j = i + 1 + l // 2
		while l < r:
			if l % 2:
				print(j, end=' ')
				j += 1
				if j > n:
					i += 1
					j = i + 1
			elif i != n:
				print(i, end=' ')
			else:
				print(1, end=' ')
			l += 1
		print()
import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	for x in args:
		file.write(str(x))
	file.write(kwargs.pop('end', '\n'))
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inputt = lambda t=0: range(t) if t else range(int(input()))
inputi = lambda : map(int, input().split())
inputl = lambda : list(inputi())
from math import *
from heapq import *
from bisect import *
from itertools import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
import re, copy, operator, cmath
from builtins import *
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	num = r - l + 1
	init_num = 1
	index = 0
	for i in range(1, n):
		init_num = i
		if l <= (n - i) * 2:
			index = l
			l = 0
			break
		else:
			l -= (n - i) * 2
	if l > 0:
		print(1)
		continue
	ans = []
	for i in range(1, n):
		if i < init_num:
			continue
		for j in range((n - i) * 2):
			if i == init_num and j < index - 1:
				continue
			elif j % 2 == 0:
				ans.append(i)
				num -= 1
			else:
				ans.append((j + 1) // 2 + i)
				num -= 1
			if num == 0:
				break
		if num == 0:
			break
	if num > 0:
		ans.append(1)
	print(*ans)


t = int(input())
for y in range(t):
	(n, l, r) = list(map(int, input().split()))
	if l == n * (n - 1) + 1:
		print(1)
		continue
	ind = 1
	ct = 1
	while 1:
		if l < ct:
			break
		ct += (n - ind) * 2
		ind += 1
	ind -= 1
	if (ct - l) % 2 == 0:
		st = ind
		print(st, end=' ')
		l += 1
	st = n + 1
	for i in range(ct - 1, l - 1, -2):
		st -= 1
	for i in range(l, r + 1):
		if i % 2 == 1:
			print(ind, end=' ')
		else:
			print(st, end=' ')
			st += 1
		if st == n + 1:
			ind += 1
			if ind == n:
				ind = 1
			st = ind + 1
	print()


for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	cursum = 0
	curn = n - 1
	while curn > 0 and cursum + (curn << 1) < l:
		cursum += curn << 1
		curn -= 1
	fix = n - curn
	d = False
	i = fix
	nexti = fix + 1
	for _ in range(cursum + 1, l):
		if d:
			nexti += 1
			if nexti > n:
				fix += 1
				nexti = fix + 1
			i = fix
		else:
			i = nexti
		d ^= True
	ans = [i]
	for _ in range(l, r):
		if d:
			nexti += 1
			if nexti > n:
				fix += 1
				nexti = fix + 1
			i = fix
		else:
			i = nexti
		ans.append(i)
		d ^= True
	if r == n * (n - 1) + 1:
		ans[-1] = 1
	elif nexti > n:
		ans[-1] = fix + 1
	print(' '.join(map(str, ans)))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split(' '))
	loop = b + 1 - a
	a -= 1
	a %= n * (n - 1)
	a += 1
	sbb = 2 * (n - 1)
	ctr = 1
	ans = []
	while a > sbb:
		ctr += 1
		sbb += 2 * n - 2 * ctr
	d = a - sbb + 2 * n - 2 * ctr
	cur = ctr
	d -= 1
	p1 = 1 + cur
	ti = 0
	while d:
		d -= 1
		ti += 1
		if ti & 1:
			cur = p1
			if p1 == n:
				ctr += 1
				p1 = ctr
		else:
			if ctr == n and p1 == n:
				ctr = 1
				p1 = 1
			p1 += 1
			cur = ctr
	for j in range(loop):
		ans.append(cur)
		ti += 1
		if ti & 1:
			cur = p1
			if p1 == n:
				ctr += 1
				p1 = ctr
		else:
			if ctr == n and p1 == n:
				ctr = 1
				p1 = 1
			p1 += 1
			cur = ctr
	print(*ans)


def solve():
	(n, l, r) = [int(i) for i in input().split()]
	seq = []
	i = 1
	while l <= r:
		while l > 2 * n - 2:
			if l == 3:
				i = 1
				break
			l -= 2 * n - 2
			r -= 2 * n - 2
			n -= 1
			i += 1
		if l % 2 == 0:
			seq.append(l // 2 + i)
		else:
			seq.append(i)
		l += 1
	return ' '.join((str(i) for i in seq))
T = int(input())
for _ in range(T):
	print(solve())


import sys
input = sys.stdin.buffer.readline
from bisect import bisect_left
T = int(input())
for _ in range(T):
	(n, l, r) = map(int, input().split())
	ls = [(n - u) * 2 for u in range(n + 1)]
	ls[0] = 1
	for i in range(1, n + 1):
		ls[i] += ls[i - 1]
	p = bisect_left(ls, l)
	sp = []
	if p == 0:
		sp = [0, 0, 0]
	else:
		d = l - ls[p - 1]
		sp = [p, p + (d + 1) // 2, 0 if d % 2 else 1]

	def getp(ls):
		if ls[0] == 0 or ls == [n - 1, n, 1]:
			return 1
		elif ls[2] == 0:
			return ls[1]
		elif ls[1] == n:
			return ls[0] + 1
		else:
			return ls[0]

	def nextp(ls):
		(a, b, c) = ls
		if a == 0:
			return [1, 2, 0]
		elif c == 0:
			return [a, b, 1]
		elif b < n:
			return [a, b + 1, 0]
		else:
			return [a + 1, a + 2, 0]
	res = []
	for _ in range(r - l + 1):
		res.append(getp(sp))
		sp = nextp(sp)
	print(' '.join(map(str, res)))


for i in range(int(input())):
	(n, l, r) = map(int, input().split())
	l -= 1
	r -= 1
	c = 0
	for j in range(n):
		if c + (n - j - 1) * 2 < l or c > r:
			c += (n - j - 1) * 2
			continue
		for k in range(j + 1, n):
			if l <= c <= r:
				print(j + 1, end=' ')
			c += 1
			if l <= c <= r:
				print(k + 1, end=' ')
			c += 1
	if l <= c <= r:
		print(1)
	else:
		print('')


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
for _ in range(int(input())):
	(n, l, r) = ilele()
	z = n * (n - 1) + 1
	if l == r and l == z or r == 1:
		print(1)
		continue
	k = n - 1
	tot = 0
	f = 0
	while tot < l and k > 0:
		f += 1
		tot += 2 * k
		k -= 1
	tot -= 2 * (k + 1)
	tot += 1
	Ans = []
	g = 0
	C = []
	m = 0
	h = f + 1
	i = tot
	while i < r + 1 and i < z:
		if g == 0:
			if i == l:
				g = 1
			if m % 2 == 0:
				C.append(f)
			elif h < n:
				C.append(h)
				h += 1
			else:
				C.append(h)
				f += 1
				h = f + 1
			if g == 1:
				Ans.append(C[-1])
		elif g == 1:
			if m % 2 == 0:
				Ans.append(f)
			elif h < n:
				Ans.append(h)
				h += 1
			else:
				Ans.append(h)
				f += 1
				h = f + 1
		m += 1
		i += 1
	if r == z:
		Ans.append(1)
	print(*Ans)


n_tests = int(input())
for _ in range(n_tests):
	(n_vertices, l, r) = list(map(int, input().split()))
	index = 0
	i_v = None
	for i_v in range(1, n_vertices):
		n_indexes_here = (n_vertices - i_v) * 2
		if l <= index + n_indexes_here:
			break
		else:
			index += (n_vertices - i_v) * 2
	else:
		print(1)
		continue
	index += 1
	next_print = i_v + 1
	while True:
		if index > r:
			break
		if index % 2 == 1:
			if index >= l:
				print(str(i_v), end=' ')
		else:
			if index >= l:
				print(next_print, end=' ')
			next_print += 1
			if next_print > n_vertices:
				i_v += 1
				if i_v == n_vertices:
					i_v = 1
				next_print = i_v + 1
		index += 1
	print('')


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, L, R):
	M = R - L + 1
	ans = []
	count = 0
	done = False
	for i in range(N - 1, -1, -1):
		if count + 2 * i < L:
			count += 2 * i
		else:
			curr = N - i
			for j in range(curr + 1, N + 1):
				if count + 1 >= L:
					ans.append(str(curr))
					if len(ans) == M:
						done = True
						break
				count += 1
				if count + 1 >= L:
					ans.append(str(j))
					if len(ans) == M:
						done = True
						break
				count += 1
			if done:
				break
	if len(ans) < M:
		ans.append('1')
	return ' '.join(ans)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, L, R) = [int(x) for x in input().split()]
	ans = solve(N, L, R)
	print(ans)


test = int(input())
for _ in range(test):
	(n, l, r) = [int(x) for x in input().split()]
	start = 1
	it = 1
	if l == n * (n - 1) + 1:
		print('1')
		continue
	while start < l:
		start += (n - it) * 2
		it += 1
	if start != l:
		it -= 1
		start -= (n - it) * 2
	a = it
	b = it + 1
	ok = True
	while start < l:
		if ok:
			ok = False
		else:
			ok = True
			b += 1
		start += 1
	while start <= r:
		if b == n + 1:
			a += 1
			b = a + 1
		if a == n:
			print('1', end=' ')
			break
		if ok:
			print(a, end=' ')
			ok = False
		else:
			print(b, end=' ')
			b += 1
			ok = True
		start += 1
	print()


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from heapq import heapify, heappush, heappop

def main():
	for _ in range(int(input())):
		(n, l, r) = map(int, input().split())
		l -= 1
		ptrn = []
		for i in range(2, 10 ** 5 + 2):
			ptrn.append(1)
			ptrn.append(i)
		lth = 2 * (n - 1)
		ans = []
		sf = 0
		ps = 0
		while lth > 0:
			for i in range(max(ps, l), min(r, ps + lth)):
				ans.append(ptrn[i - ps] + sf)
			ps += lth
			lth -= 2
			sf += 1
		if r == n * (n - 1) + 1:
			ans.append(1)
		print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	t = int(input())
	for _ in range(t):
		(n, l, r) = map(int, input().split())
		if l == n * n - n + 1:
			print(1)
			continue
		if r == n * n - n + 1:
			r_g = n
		for i in range(n - 1):
			if l > 2 * n - 2 - 2 * i:
				l -= 2 * n - 2 - 2 * i
			else:
				l_g = i + 1
				break
		for i in range(n - 1):
			if r > 2 * n - 2 - 2 * i:
				r -= 2 * n - 2 - 2 * i
			else:
				r_g = i + 1
				break
		ans = []
		for i in range(l_g, min(r_g + 1, n)):
			for j in range(i + 1, n + 1):
				ans.append(i)
				ans.append(j)
		if r_g == n:
			ans.append(1)
		if r_g == n or r == 2 * n - 2 * r_g:
			print(*ans[l - 1:])
		else:
			print(*ans[l - 1:r + 2 * r_g - 2 * n])
main()


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
T = int(input())
for idx_testcase in range(T):
	(N, L, R) = map(int, input().split())
	f = False
	if R == N * (N - 1) + 1:
		if L == R:
			print(1)
			continue
		f = True
		R -= 1
	s = 0
	d = 2 * N
	i = 0
	Ans = [0] * (R - L + 1)
	while s < L:
		d -= 2
		s += d
		i += 1
	s -= d
	numer = L - s
	for idx_ans in range(R - L + 1):
		if numer % 2:
			Ans[idx_ans] = i
		else:
			Ans[idx_ans] = numer // 2 + i
		numer += 1
		if Ans[idx_ans] == N:
			numer = 1
			i += 1
	if f:
		Ans.append(1)
	print(*Ans)


def find(a):
	global k, tot
	if a > n * (n - 1):
		return 1
	while a > tot + (n - k) * 2:
		tot += (n - k) * 2
		k += 1
	if a & 1:
		return k
	return (a - tot) // 2 + k
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	global k, tot
	k = 1
	tot = 0
	li = []
	for i in range(l, r + 1):
		li.append(find(i))
	print(*li)


for f in range(int(input())):
	(n, l, r) = map(int, input().split())
	s = [0] * (r - l + 1)
	i = 1
	p = 1
	t = 2 * n - ((2 * n) ** 2 - 4 * l) ** 0.5
	t = t / 2
	t = int(t)
	t -= 1
	if t > 0:
		p = 2 * (t * n - t * (t + 1) // 2)
		p += 1
		i += t
	while p + 2 * (n - i) <= l and i < n:
		p += 2 * (n - i)
		i += 1
	j = i + 1
	while p + 2 <= l:
		p += 2
		j += 1
	sm = 1
	if p < l:
		sm = 0
	for foo in range(r - l + 1):
		if sm == 1:
			s[foo] = i
			sm = 0
		else:
			s[foo] = j
			j += 1
			sm = 1
			if j == n + 1:
				i += 1
				j = i + 1
	if r == n * (n - 1) + 1:
		s[r - l] = 1
	print(*s)


from bisect import bisect_left

def get(x, n):
	if x == n:
		return [1]
	return [a for i in range(x + 1, n + 1) for a in [x, i]]

def solve():
	(n, l, r) = map(int, input().split())
	cum = [0] * (n + 1)
	for i in range(1, n):
		cum[i] = cum[i - 1] + 2 * (n - i)
	cum[n] = cum[n - 1] + 1
	xL = bisect_left(cum, l)
	xR = bisect_left(cum, r)
	hL = l - cum[xL - 1] - 1
	hR = r - cum[xR - 1] - 1
	if xL == xR:
		u = get(xL, n)
		print(*u[hL:hR + 1])
		return
	(uL, uR) = (get(xL, n), get(xR, n))
	print(*uL[hL:], end=' ')
	for x in range(xL + 1, xR):
		print(*get(x, n), end=' ')
	print(*uR[:hR + 1])
	return
for _ in range(int(input())):
	solve()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=10 ** 10, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(200001)]
pp = []

def SieveOfEratosthenes(n=200000):
	p = 2
	c = 0
	while p * p <= n:
		if prime[p] == True:
			c += 1
			pp.append(p)
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = 0
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = mid + 1
			left = mid + 1
	return res
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	a = [0]
	start = 2 * (n - 1)
	while start > 0:
		a.append(a[-1] + start)
		start -= 2
	a.append(a[-1] + 1)
	if l == 1 + n * (n - 1):
		print(1)
		continue
	res = []
	k = 0
	for i in range(len(a)):
		if a[i] >= l:
			start = i
			k = n - (a[i] - l) // 2
			break
	for i in range(l, r + 1):
		if k > n:
			start += 1
			if start == n:
				start = 1
			k = start + 1
		if i % 2:
			res.append(start)
		else:
			res.append(k)
			k += 1
	print(*res)


import sys
input = sys.stdin.buffer.readline
for t in range(int(input())):
	(n, l, r) = map(int, input().split())
	for i in range(l, min(2 * (n - 2) + 1, r) + 1):
		print('1' if i & 1 else i // 2 + 1, end=' ')
	n_set = n
	set_idx = 2 * (n - 2) + 2
	while n_set > 2:
		ls = l - set_idx + 1
		rs = r - set_idx + 1
		set_idx += 2 * (n_set - 2)
		set_par = n - n_set + 2
		if ls < 2 and rs >= 1:
			print(n, end=' ')
		for i in range(max(2, ls), min(2 * (n_set - 2), rs) + 1):
			print(set_par + (i - 1) // 2 if i & 1 else set_par, end=' ')
		n_set -= 1
	l -= set_idx
	r -= set_idx
	if l <= 0 and r >= 0:
		print(n, end=' ')
	if r == 1:
		print(1, end=' ')
	print()


import sys
import math as mt
t = int(input())
for __ in range(t):
	(n, l, r) = map(int, input().split())
	j = 1
	k = 2 * n - 2
	mul = 1
	k = 2 * n - 2
	r1 = k
	l1 = 1
	for i in range(n - 2):
		if l >= l1 and l <= r1:
			break
		k -= 2
		l1 = r1 + 1
		r1 = l1 + k - 1
		mul += 1
	nex = mul
	ch = 0
	for i in range(l1, min(r1 + 1, r + 1)):
		if i >= l:
			if ch % 2 != 0:
				nex += 1
				print(nex, end=' ')
			else:
				print(mul, end=' ')
		elif ch % 2 != 0:
			nex += 1
		ch += 1
		if i > r1:
			break
	i = r1 + 1
	mul += 1
	ch = 0
	nex = mul
	k -= 1
	while i <= min(r, n * (n - 1)):
		if ch % 2 == 0:
			print(mul, end=' ')
		else:
			nex += 1
			print(nex, end=' ')
		i += 1
		ch += 1
		if ch == 2 * (n - mul):
			mul += 1
			ch = 0
			nex = mul
	if r == n * (n - 1) + 1:
		print(1, end=' ')
	print()


T = int(input().strip())
for t in range(T):
	(n, l, r) = map(int, input().strip().split())
	if l == n * (n - 1) + 1:
		print(1)
		continue
	k = int((2 * n - 1 - ((2 * n - 1) ** 2 - 4 * l) ** 0.5) / 2)
	if l <= 2 * k * n - k * (k + 1):
		k -= 1
	if l > 2 * (k + 1) * n - (k + 1) * (k + 2):
		k += 1
	m = 2 * k * n - k * (k + 1)
	s = []
	k += 1
	j = (l - m - 1) // 2 + k
	while l <= r:
		if l % 2 == 1:
			if k == n:
				s.append(1)
			else:
				s.append(k)
		else:
			j += 1
			s.append(j)
			if j == n:
				k += 1
				j = k
		l += 1
	print(' '.join(map(str, s)))


from sys import stdin

def allWays(start, verts, done, stack, n):
	global valid
	if not valid:
		return
	stack.append(start)
	if len(done) == len(verts):
		print(stack)
		stack.pop()
		valid = False
		return
	for x in range(1, n + 1):
		if start != x and (not (start, x) in done):
			done.add((start, x))
			allWays(x, verts, done, stack, n)
			done.remove((start, x))
	stack.pop()

def order(n, x):
	out = []
	for y in range(x + 1, n + 1):
		out.append(x)
		out.append(y)
	return out
for case in range(int(stdin.readline())):
	(n, l, r) = [int(x) for x in stdin.readline().split()]
	end1 = False
	if r == n * (n - 1) + 1:
		end1 = True
		r -= 1
	if l == n * (n - 1) + 1:
		print(1)
	else:
		x = 1
		while l > 2 * (n - x):
			l -= 2 * (n - x)
			r -= 2 * (n - x)
			x += 1
		out = order(n, x)
		r -= 2 * (n - x)
		x += 1
		while r > 0:
			out += order(n, x)
			r -= 2 * (n - x)
			x += 1
		if end1:
			out += [1]
		if r != 0:
			realOut = out[l - 1:r]
		else:
			realOut = out[l - 1:]
		print(' '.join([str(b) for b in realOut]))


import sys
import collections

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	(n, l, r) = read_int_line()
	u = r - l + 1
	lt = l
	k = n
	while lt > 0 and k > 0:
		k -= 1
		lt -= 2 * k
	lt += 2 * k
	k = n - k
	j = max(k, 1)
	s = 0
	for i in range(1, j):
		s += 2 * (n - i)
	lt = l
	lt -= s
	lt += 1
	i = j + lt // 2
	ans = []
	if l % 2 == 0:
		ans.append(i)
		i += 1
	while j <= n and len(ans) <= u:
		if j != k:
			i = j + 1
		while i <= n and len(ans) <= u:
			ans.append(j)
			ans.append(i)
			i += 1
		j += 1
	ans.append(1)
	print(*ans[:u])


from bisect import bisect_left, bisect_right

class Result:

	def __init__(self, index, value):
		self.index = index
		self.value = value

class BinarySearch:

	def __init__(self):
		pass

	@staticmethod
	def greater_than(num: int, func, size: int=1):
		if isinstance(func, list):
			index = bisect_right(func, num)
			if index == len(func):
				return Result(None, None)
			else:
				return Result(index, func[index])
		else:
			(alpha, omega) = (0, size - 1)
			if func(omega) <= num:
				return Result(None, None)
			while alpha < omega:
				if func(alpha) > num:
					return Result(alpha, func(alpha))
				if omega == alpha + 1:
					return Result(omega, func(omega))
				mid = (alpha + omega) // 2
				if func(mid) > num:
					omega = mid
				else:
					alpha = mid

	@staticmethod
	def less_than(num: int, func, size: int=1):
		if isinstance(func, list):
			index = bisect_left(func, num) - 1
			if index == -1:
				return Result(None, None)
			else:
				return Result(index, func[index])
		else:
			(alpha, omega) = (0, size - 1)
			if func(alpha) >= num:
				return Result(None, None)
			while alpha < omega:
				if func(omega) < num:
					return Result(omega, func(omega))
				if omega == alpha + 1:
					return Result(alpha, func(alpha))
				mid = (alpha + omega) // 2
				if func(mid) < num:
					alpha = mid
				else:
					omega = mid
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
bs = BinarySearch()
for _ in range(int(input()) if True else 1):
	(n, l, r) = map(int, input().split())
	a = [0]
	total = 0
	for i in range(n - 1, 0, -1):
		total += 2 * i
		a += [total]
	ans = []
	for i in range(l, r + 1):
		if i == n ** 2 - n + 1:
			ans += [1]
		else:
			index = bs.less_than(i, a).index
			position = (i - a[index]) // 2
			if i % 2:
				ans += [index + 1]
			else:
				ans += [index + 1 + position]
	print(*ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import bisect
for j in range(int(input())):
	(n, l, r) = map(int, input().split())
	vals = [2 * (n - 1)]
	for s in range(1, n):
		vals.append(vals[-1] - 2)
	vals[-1] = 1
	prefsum = [vals[0]]
	for s in range(1, len(vals)):
		prefsum.append(prefsum[-1] + vals[s])
	ans = []
	ind0 = bisect.bisect_left(prefsum, l)
	ind1 = bisect.bisect_left(prefsum, r)
	for s in range(ind0, ind1 + 1):
		for i in range(s + 1, n):
			ans.append(s + 1)
			ans.append(i + 1)
		if s + 1 == n:
			ans.append(1)
	lbound = l
	if ind0 > 0:
		lbound -= prefsum[ind0 - 1]
	if len(ans) > 0:
		print(*ans[lbound - 1:r - l + lbound])
	else:
		print(1)


from sys import stdin, gettrace

def input():
	return stdin.buffer.readline()
t = int(input())
for _ in range(t):
	(n, l, r) = list(map(int, input().split()))
	count = 0
	i = 1
	while count < l:
		if i == n:
			i = 1
		count += (n - i) * 2
		i += 1
	i -= 1
	count -= (n - i) * 2
	j = i + (l - count + 1) // 2
	length = r - l + 1
	if l % 2 == 0:
		print(j, end=' ')
		j += 1
		length -= 1
		if j > n:
			i += 1
			j = i + 1
	while length > 0:
		if i == n:
			i = 1
		print(i, end=' ')
		length -= 1
		if length <= 0:
			break
		print(j, end=' ')
		length -= 1
		j += 1
		if j > n:
			i += 1
			j = i + 1
	print()


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, l, r) = map(int, input().split())
	(lb, ub) = (0, n)
	while ub - lb > 1:
		m = (lb + ub) // 2
		if m * (2 * n - m - 1) < l:
			lb = m
		else:
			ub = m
	i = ub
	s = lb * (2 * n - lb - 1) + 1
	j = (l - s + 1) // 2 + i
	ans = []
	for k in range(l, r + 1):
		if i == n:
			i = 1
		if (k - s) % 2 == 0:
			ans.append(i)
			j += 1
		else:
			ans.append(j)
			if j == n:
				s = k + 1
				i += 1
				j = i
	print(*ans)


import sys
input = sys.stdin.buffer.readline
from bisect import bisect_left
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
B = [0]
for i in range(1, 2 * 10 ** 5):
	B.append(i * (i + 1) // 2)

def solve(n, N):
	M = N * (N - 1)
	n %= M
	if n % 2 == 0:
		rem = (M - n) // 2
		ind = bisect_left(B, rem)
		return N - ind
	else:
		rem = (M - (n - 1)) // 2
		ind = bisect_left(B, rem)
		seq = rem - ind * (ind - 1) // 2
		return N - seq + 1
for (N, L, R) in Query:
	ans = []
	for n in range(L - 1, R):
		ans.append(str(solve(n, N)))
	print(' '.join(ans))


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	l -= 1
	r -= 1
	(flag, tmp, s) = (1, 0, 0)
	ans = []
	(x, y) = (n, n - 1)
	for i in range(1, n):
		s += 2 * (n - i)
		if l < s and flag:
			(x, tmp) = (i, (i > 1) * (s - 2 * (n - i)))
			l -= tmp
			flag = 0
		if r < s:
			y = i
			r -= tmp
			break
	if x > y:
		(l, r) = (0, 0)
	for i in range(x, y + 1):
		for j in range(i + 1, n + 1):
			ans.append(i)
			ans.append(j)
	ans.append(1)
	print(*ans[l:r + 1])


import sys
input = sys.stdin.readline
for t in range(int(input())):
	(n, l, r) = map(int, input().split(' '))
	startSection = 2 * (n - 1)
	startCount = 1
	while l > startSection:
		startCount = startCount + 1
		if startCount < n:
			startSection = startSection + 2 * (n - startCount)
		else:
			startSection = startSection + 1
	endCount = startCount
	endSection = startSection
	while r > endSection:
		endCount = endCount + 1
		if endCount < n:
			endSection = endSection + 2 * (n - endCount)
		else:
			endSection = endSection + 1
	l = l - startSection + 2 * (n - startCount) - 1
	r = r - startSection + 2 * (n - startCount)
	if r == 0:
		r = r + 1
	string = []
	for go in range(startCount, endCount + 1):
		for k in range(n - go):
			string.append(go)
			string.append(k + 1 + go)
	string.append(1)
	ans = list(map(str, string[l:r]))
	print(' '.join(ans))


import os
import sys
from io import BytesIO, IOBase

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	while T:
		T -= 1
		(n, l, r) = lin()
		l -= 1
		r -= 1
		(ch, ch1) = (n - 1, 1)
		sm = 0
		while l > sm + ch * 2:
			sm += ch * 2
			ch -= 1
			ch1 += 1
		ans = []
		ch3 = ch * 2 - (l - sm)
		while l <= r:
			if ch3 == 0:
				sm += ch * 2
				ch -= 1
				ch1 += 1
				ch3 = ch * 2
			ch3 -= 1
			if l % 2 == 0:
				ans.append(ch1)
			else:
				ans.append((l - sm) // 2 + ch1 + 1)
			l += 1
		if ch1 == n:
			ans[-1] = 1
		print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	cycle_size = 2 * (n - 1)
	cycle_start = 1
	cycle_number = 1
	while cycle_start + cycle_size <= l and cycle_number != n:
		cycle_start += cycle_size
		cycle_number += 1
		cycle_size -= 2
	ans = []
	while l <= r:
		if l - cycle_start & 1:
			if not cycle_size:
				ans.append(1)
			else:
				ans.append(cycle_number + (l - cycle_start + 1) // 2)
		elif not cycle_size:
			ans.append(1)
		else:
			ans.append(cycle_number)
		l += 1
		if l - cycle_start >= cycle_size:
			cycle_start += cycle_size
			cycle_size -= 2
			cycle_number += 1
	print(' '.join((str(x) for x in ans)))


import sys
import math
input = sys.stdin.readline
from functools import cmp_to_key

def pi():
	return int(input())

def pl():
	return int(input(), 16)

def ti():
	return list(map(int, input().split()))

def ts():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
mod = 1000000007
f = []

def fact(n, m):
	global f
	f = [1 for i in range(n + 1)]
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % m

def fast_mod_exp(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b = b >> 1
	return res

def inverseMod(n, m):
	return fast_mod_exp(n, m - 2, m)

def ncr(n, r, m):
	if r == 0:
		return 1
	return f[n] * inverseMod(f[n - r], m) % m * inverseMod(f[r], m) % m

def main():
	D()

def xdfs(root, v, sub, parent):
	st = [root]
	while len(st) > 0:
		node = st.pop()
		for i in range(len(v[node])):
			if v[node][i] != node:
				st.append(v[node][i])

def X():
	try:
		t = pi()
		while t:
			t -= 1
			n = pi()
			v = [[] for i in range(n)]
			for i in range(n - 1):
				[x, y] = ti()
				v[x - 1].append(y - 1)
				v[y - 1].append(x - 1)
			m = pi()
			p = ti()
			e = [0 for i in range(n - 1)]
			sub = [0 for i in range(n)]
			dfs(0, v, sub, -1)
			for i in range(1, n):
				e[i - 1] = sub[i] * (n - sub[i])
			if len(p) < n - 1:
				while len(p) < n - 1:
					p.append(1)
			p = sorted(p)
			if len(p) > n - 1:
				x = 1
				for i in range(n - 2, len(p)):
					x = x * p[i]
				while len(p) > n - 2:
					p.pop()
				p.append(x)
			e = sorted(e)
			res = 0
			for i in range(n - 1):
				res = (res + p[i] * e[i]) % mod
			print(res)
	except:
		print(sys.exc_info())

def bfs(v, root):
	q = [root, None]
	l = 0
	visited = [0 for i in range(len(v))]
	dist = [0 for i in range(len(v))]
	while len(q) > 0:
		node = q.pop(0)
		if node is not None:
			visited[node] = 1
			dist[node] = l
			for i in range(len(v[node])):
				if visited[v[node][i]] == 0:
					visited[v[node][i]] = 1
					q.append(v[node][i])
		else:
			l += 1
			if len(q) != 0:
				q.append(None)
	return dist

def B():
	n = pi()
	v = [[] for i in range(n)]
	for i in range(n - 1):
		[x, y] = ti()
		v[x - 1].append(y - 1)
		v[y - 1].append(x - 1)
	leafs = []
	for i in range(n):
		if len(v[i]) == 1:
			leafs.append(i)
	mn = 1
	d = bfs(v, leafs[0])
	for i in range(1, len(leafs)):
		if d[leafs[i]] % 2 != 0:
			mn = 3
			break
	count = 0
	for i in range(n):
		f = 0
		for j in range(len(v[i])):
			if len(v[v[i][j]]) == 1:
				f = 1
				break
		if f:
			count += 1
	mx = n - 1 - len(leafs) + count
	print(mn, mx)

def D():
	t = pi()
	while t:
		t -= 1
		[n, l, r] = ti()
		p = 0
		i = 1
		nxt = 0
		res = []
		st = 0
		while i <= n and p <= l:
			if p + 2 * (n - i) >= l:
				d = l - p - 1
				if d % 2 == 0:
					st = i
					nxt = i + 1 + d / 2
				if d % 2 != 0:
					st = i + 1 + (d - 1) / 2
				p = l
				break
			p += 2 * (n - i)
			i += 1
		while i <= n and p <= r:
			if nxt != 0:
				while p <= r and nxt <= n:
					if p <= r:
						res.append(i)
						p += 1
					if p <= r:
						res.append(int(nxt))
						p += 1
					nxt += 1
				i += 1
				nxt = i + 1
			else:
				nxt = st + 1
				res.append(int(st))
				p += 1
				while p <= r and nxt <= n:
					if p <= r:
						res.append(i)
						p += 1
					if p <= r:
						res.append(int(nxt))
						p += 1
					nxt += 1
				i += 1
				nxt = i + 1
		if r == (n - 1) * (n - 1) + n:
			res.append(1)
		print(*res, sep=' ')
main()


t = int(input())
for i in range(t):
	(n, l, r) = map(int, input().split())
	if l == n * (n - 1) + 1:
		print(1)
		continue
	(left, right, summ) = (0, n, 0)
	while left != right - 1:
		mid = (left + right) // 2
		tmp = n * mid - mid * (mid + 1) // 2
		if 2 * tmp < l:
			left = mid
			summ = 2 * tmp
		else:
			right = mid
	beg = summ
	count = left + 1
	ans = []
	ind = False
	for i in range(count, n):
		for j in range(i + 1, n + 1):
			ans.append(i)
			ans.append(j)
			summ += 2
			if summ > r:
				ind = True
				break
		if ind:
			break
	ans.append(1)
	for i in range(l - 1, r):
		print(ans[i - beg], end=' ')
	print()


R = lambda : map(int, input().split())
t = int(input())

def block(b, pos, n):
	if pos % 2 == 0:
		return b
	return b + (pos + 1) // 2

def binary(k, n):
	(left, right) = (1, n + 1)
	while left <= right:
		m = (left + right) // 2
		if m * (m + 1) >= k > m * (m - 1):
			return m
		if m * (m + 1) < k:
			left = m + 1
		if m * (m - 1) >= k:
			right = m - 1

def whatis(k, n):
	k = n * (n - 1) + 1 - k
	if k == 0:
		return 1
	i = binary(k, n)
	return block(n - i, -k + i * (i + 1), n)
for _ in range(t):
	(n, l, r) = R()
	ans = []
	for i in range(l, r + 1):
		ans.append(whatis(i, n))
	print(*ans)


def go():
	(n, l, r) = map(int, input().split())
	tot = n * (n - 1) + 1
	add = []
	if r == tot:
		add = ['1']
		r -= 1
	res = []
	if l <= r:
		cur = 0
		nextg = n - 1
		while cur + 2 * nextg < l:
			cur += 2 * nextg
			nextg -= 1
		g = n - nextg
		shift = l - cur - 1
		(pair, par) = divmod(shift, 2)
		pair += g + 1
		while l <= r:
			if par == 0:
				res.append(g)
				par += 1
			else:
				res.append(pair)
				par = 0
				if pair < n:
					pair += 1
				else:
					g += 1
					pair = g + 1
			l += 1
	res = res + add
	return ' '.join(map(str, res))
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


CASES = int(input())
answers = []
while CASES:
	CASES -= 1
	(num, begin, end) = [int(x) for x in input().split(' ')]
	sequence = []
	index = 1
	tempB = begin
	tempE = end
	temp = 2 * (num - index)
	while tempB > temp and index < num:
		tempB -= temp
		tempE -= temp
		index += 1
		temp = 2 * (num - index)
	i = 0
	while i < tempE and index <= num:
		if index == num:
			sequence.append(1)
			i += 1
		else:
			for x in range(index, num):
				sequence.append(index)
				sequence.append(x + 1)
				i += 2
		index += 1
	tempE = tempE if tempE > tempB else tempB
	answers.append(' '.join([str(x) for x in sequence[tempB - 1:tempE]]))
for ans in answers:
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	b = 1
	for i in range(1, n):
		a = b
		b = b + 2 * (n - i)
		if l < b:
			break
	(x, y) = (i, (l - a) // 2 + i + 1)
	b = (l - a) % 2
	for koi_var in range(r - l):
		if b != 0:
			print(y, end=' ')
			y = y + 1
			if y == n + 1:
				x = x + 1
				y = x + 1
		else:
			print(x, end=' ')
		b = b ^ 1
	if r == n * (n - 1) + 1:
		print(1)
	else:
		print(y if b != 0 else x)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():

	def c(sm, a1):
		sm = n * a1 + (n - 1) * n
	for _ in range(N()):
		(n, l, r) = RL()
		i = n - 1
		sm = 0
		while sm + i * 2 + 1 < l:
			sm += i * 2 if i > 0 else 1
			i -= 1
		dif = l - sm
		res = []
		for j in range(n - i, n):
			now = []
			for k in range(j + 1, n + 1):
				now.append(j)
				now.append(k)
			res += now
			if len(res) > r - l + 1 + dif:
				break
		res = res[dif - 1:]
		if r == (n - 1) * n + 1:
			res.append(1)
		print(*res[:r - l + 1])
main()


from sys import stdin, stdout
import collections
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	loop = r - l + 1
	if r == n * (n - 1) + 1:
		loop -= 1
	ans = ''
	t_l = 2 * (n - 1)
	t_r = 2 * (n - 1)
	i = 1
	while l > t_l:
		i += 1
		if i != n:
			t_l += 2 * (n - i)
		else:
			t_l += 1
	t_l -= 2 * (n - i)
	l -= t_l
	for m in range(loop):
		if l % 2 == 0:
			print(i + l // 2, end=' ')
			if i + l // 2 == n:
				i += 1
				l = 1
			else:
				l += 1
		else:
			print(i, end=' ')
			l += 1
	if r == n * (n - 1) + 1:
		print('1', end=' ')
	print()


t = int(input())

def query(i, n, x):
	if x % 2 == 1:
		return i
	else:
		return i + x // 2
for _ in range(t):
	(n, l, r) = map(int, input().split())
	i = 1
	s = 0
	includeOne = False
	if r == n * (n - 1) + 1:
		includeOne = True
		r -= 1
	if l == n * (n - 1) + 1:
		print(1)
		continue
	while s + 2 * (n - i) < l:
		s += 2 * (n - i)
		i += 1
	newS = s
	allIs = [i]
	while newS + 2 * (n - i) < r:
		newS += 2 * (n - i)
		i += 1
		allIs.append(i)
	allIin = 0
	answer = []
	i = allIs[0]
	for x in range(l, r + 1):
		r = query(i, n, x - s)
		if r == n:
			s += 2 * (n - i)
			i += 1
		answer.append(r)
	if includeOne:
		answer.append(1)
	print(*answer)


import sys
input = sys.stdin.readline
(t,) = map(int, input().split())

def gen(k):
	return [k + (i + 1) // 2 if i % 2 else k for i in range(2 * (n - k))]
for _ in range(t):
	(n, s, e) = map(int, input().split())
	(k, sm) = (0, 0)
	while sm < s and k < n - 1:
		k += 1
		sm += 2 * (n - k)
	if sm < s:
		k += 1
	(k2, sm2) = (0, 0)
	while sm2 < e and k2 < n - 1:
		k2 += 1
		sm2 += 2 * (n - k2)
	if sm2 < e:
		k2 += 1
	if k == n:
		print(1)
	elif k == k2:
		L = gen(k)
		(tt, tt2) = (sm - 2 * (n - k), sm2 - 2 * (n - k2))
		print(*L[s - tt - 1:e - tt2])
	else:
		(tt, tt2) = (sm - 2 * (n - k), sm2 - 2 * (n - k2))
		L = gen(k)[s - tt - 1:]
		L2 = gen(k2)[:e - tt2]
		for l in range(k + 1, k2):
			L += gen(l)
		L += L2
		if k2 == n:
			L.append(1)
		print(*L)


import sys
input = sys.stdin.readline
T = int(input())
for tests in range(T):
	(n, l, r) = map(int, input().split())
	begin = 1
	while l > (n - begin) * 2 + 1:
		if begin == n:
			break
		l -= (n - begin) * 2
		r -= (n - begin) * 2
		begin += 1
	if begin == n:
		ANS = [n, 1]
	else:
		ANS = []
		while len(ANS) <= r:
			if begin == n:
				ANS.append(1)
				break
			for j in range(begin + 1, n + 1):
				ANS.append(begin)
				ANS.append(j)
			begin += 1
	sys.stdout.write(' '.join(map(str, ANS[l - 1:r])) + '\n')


from sys import stdin, stdout
import math

def expandList(i, n):
	if i != n:
		out = []
		for j in range(n - i):
			out.append(i)
			out.append(i + j + 1)
		return out
	else:
		return [1]
T = int(stdin.readline().rstrip())
for iTest in range(T):
	(n, l, r) = list(map(int, stdin.readline().rstrip().split(' ')))
	listSizes = [2 * i for i in range(n - 1, -1, -1)]
	listSizes[n - 1] = 1
	found = False
	a = 0
	i = 1
	while l > a + listSizes[i - 1]:
		a += listSizes[i - 1]
		i += 1
	listi = expandList(i, n)
	ind = l - a - 1
	startList = listi[ind:]
	while r > a + listSizes[i - 1]:
		a += listSizes[i - 1]
		i += 1
		startList += expandList(i, n)
	endList = expandList(i + 1, n)
	startList += endList
	startList = startList[:r - l + 1]
	print(' '.join([str(x) for x in startList]))