Initially, there is a magical stone of mass 2^{N} lying at the origin of the number line. For the next N seconds, the following event happens: 

Let us define the *decomposition* of a magical stone as follows: If there is a magical stone of mass M > 1 lying at coordinate X, then it decomposes into two magical stones, each of mass \frac{M}{2} lying at the coordinates X-1 and X+1 respectively. The original stone of mass M gets destroyed in the process. 
Each second, all the magical stones undergo *decomposition* simultaneously.

Note that there can be more than one stone at any coordinate X. 

Given a range [L, R], find out the number of stones present at each of the coordinates in the range [L, R]. As the number of stones can be very large, output them modulo (10^{9} + 7). 

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

- The first line contains a single integer T - the number of test cases. Then the test cases follow.
- The first and only line of each test case contains three integers N, L and R, as described in the problem statement. 

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

For each testcase, output in a single line a total of (R-L+1) space-separated integers. The i^{th} integer will denote the number of stones present at X = (L+i-1) coordinate.
As the number of stones can be very large, output them modulo (10^{9} + 7). 

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

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 10^{6}$
$-N ≤ L ≤ R ≤ N$
- Sum of $(R-L+1)$ over all the test cases doesn't exceed $10^{5}$. 

----- Sample Input 1 ------ 
3
2 -2 2
2 0 2
150000 48 48

----- Sample Output 1 ------ 
1 0 2 0 1
2 0 1
122830846

----- explanation 1 ------ 
Test case 1: Let us look at the number of stones for $x = -2$ to $x = 2$ as the time progresses:

$t = 0$: $\{0, 0, 1, 0, 0\}$

$t = 1$: $\{0, 1, 0, 1, 0\}$

$t = 2$: $\{1, 0, 2, 0, 1\}$

We have to output the number of stones at $x = -2$ to $x = 2$, which is $\{1, 0, 2, 0, 1\}$.

Test case 2: Similar to first test case, We have to output the number of stones at $x = 0$ to $x = 2$, which is $\{2, 0, 1\}$.

Source: codechef | Difficulty: HARD
Tags: Combinatorics

Mathematics


Solutions:
def mod_pow(a, b, m):
	if b == 0:
		return 1
	if b == 1:
		return a % m
	tmp = mod_pow(a, b // 2, m)
	tmp = tmp * tmp % m
	if b % 2 == 1:
		tmp = tmp * a % m
	return tmp

def ncr(n, a, m, fact):
	first = mod_pow(fact[a], m - 2, m)
	second = mod_pow(fact[n - a], m - 2, m)
	res = fact[n] * first * second % m
	return res
mod = 10 ** 9 + 7
fact = [1]
for i in range(1, 10 ** 6 + 1):
	fact.append(fact[-1] * i % mod)
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	ans = []
	for x in range(l, r + 1):
		if (x + n) % 2 != 0 or (n - x) % 2 != 0:
			ans.append(0)
		else:
			a = (n + x) // 2
			b = (n - x) // 2
			ans.append(ncr(n, a, mod, fact))
	print(*ans)


import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)
mod = 10 ** 9 + 7
max_n = 10 ** 6
fact = [1, 1]
for i in range(2, 1 + max_n):
	fact.append(fact[-1] * i % mod)

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

def ncr(a, b):
	return fact[a] * inv_mod(fact[b]) * inv_mod(fact[a - b]) % mod
for _ in range(int(input())):
	(n, l, r) = list(map(int, input().split()))
	for i in range(l, r + 1):
		if n % 2 == i % 2 and -n <= i <= n:
			print(ncr(n, (n - abs(i)) // 2), end=' ')
		else:
			print(0, end=' ')
	print()


def fermat_compute(n, p):
	facts = [0] * n
	invfacts = [0] * n
	facts[0] = 1
	invfacts[0] = 1
	for i in range(1, n):
		facts[i] = facts[i - 1] * i % p
		invfacts[i] = pow(facts[i], p - 2, p)
	return (facts, invfacts)

def binomial_pre_computed(facts, invfacts, n, k, p):
	return facts[n] * (invfacts[k] * invfacts[n - k] % p) % p
for _ in range(int(input())):
	ans = ''
	(n, l, r) = map(int, input().split())
	(facts, invfacts) = fermat_compute(n + 1, 10 ** 9 + 7)
	for x in range(l, r + 1):
		idx = abs(x)
		ans += '0' if (n ^ idx) & 1 else str(binomial_pre_computed(facts, invfacts, n, (n - idx) // 2, 10 ** 9 + 7))
		ans += ' '
	print(ans)


import sys
msg = sys.stdin.readlines()
mod = 10 ** 9 + 7
for inp in msg[1:]:
	row = [1]
	last = 1
	(a, b, c) = list(map(int, inp.split()))
	for i in range(1, a + 1):
		now = last * (a + 1 - i) % mod
		inv_k = pow(i, mod - 2, mod)
		now = now * inv_k % mod
		row.append(0)
		row.append(now)
		last = now
	b = a + b
	c = a + 1 + c
	for i in row[b:c]:
		print(i, end=' ')
	print()


import math
N = 1000001
factorialNumInverse = [None] * (N + 1)
naturalNumInverse = [None] * (N + 1)
fact = [None] * (N + 1)

def InverseofNumber(p):
	naturalNumInverse[0] = naturalNumInverse[1] = 1
	for i in range(2, N + 1, 1):
		naturalNumInverse[i] = naturalNumInverse[p % i] * (p - int(p / i)) % p

def InverseofFactorial(p):
	factorialNumInverse[0] = factorialNumInverse[1] = 1
	for i in range(2, N + 1, 1):
		factorialNumInverse[i] = naturalNumInverse[i] * factorialNumInverse[i - 1] % p

def factorial(p):
	fact[0] = 1
	for i in range(1, N + 1):
		fact[i] = fact[i - 1] * i % p

def Binomial(N, R, p):
	ans = fact[N] * factorialNumInverse[R] % p * factorialNumInverse[N - R] % p
	return ans
p = 1000000007
InverseofNumber(p)
InverseofFactorial(p)
factorial(p)
t = int(input())
while t:
	(n, lb, rb) = map(int, input().split())
	ans = ''
	if n % 2 == 0:
		r = n // 2 + lb // 2
		while lb <= rb:
			if lb % 2:
				ans += '0 '
			else:
				val = Binomial(n, r, p)
				ans += str(val) + ' '
			lb += 1
			r = n // 2 + lb // 2
	else:
		r = n // 2 + lb // 2 + 1
		while lb <= rb:
			if lb % 2:
				val = Binomial(n, r, p)
				ans += str(val) + ' '
			else:
				ans += '0 '
			lb += 1
			r = n // 2 + lb // 2 + 1
	print(ans)
	t -= 1


x = int(1000000000.0 + 7)
factorial = [1]
for i in range(1, 1000001):
	factorial.append(factorial[-1] * i % x)
T = int(input())
for _ in range(T):
	(N, L, R) = map(int, input().split())
	while L <= R:
		if (L + N) % 2 == 0:
			c = (L + N) // 2
			val = factorial[N] * pow(factorial[c], x - 2, x) * pow(factorial[N - c], x - 2, x)
			print(val % x, end=' ')
		else:
			print(0, end=' ')
		L += 1
	print()


x = int(1000000000.0 + 7)
factorial = [1]
for i in range(1, 1000001):
	factorial.append(factorial[-1] * i % x)
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	while l <= r:
		if (l + n) % 2 == 0:
			c = (l + n) // 2
			val = factorial[n] * pow(factorial[c], x - 2, x) * pow(factorial[n - c], x - 2, x)
			print(val % x, end=' ')
		else:
			print(0, end=' ')
		l += 1
	print()


p = 1000000007
factorials = [1]
for i in range(1, 1000001):
	factorials.append(factorials[-1] * i % p)
for T in range(int(input())):
	(N, L, R) = map(int, input().split())
	for coordinate in range(L, R + 1):
		index_float = (N + coordinate) / 2
		index = int(index_float)
		if index != index_float:
			print(0, end=' ')
		else:
			print(factorials[N] * pow(factorials[index], p - 2, p) * pow(factorials[N - index], p - 2, p) % p, end=' ')
	print()


N = 1000001
factorialNumInverse = [None] * (N + 1)
naturalNumInverse = [None] * (N + 1)
fact = [None] * (N + 1)

def InverseofNumber(p):
	naturalNumInverse[0] = naturalNumInverse[1] = 1
	for i in range(2, N + 1, 1):
		naturalNumInverse[i] = naturalNumInverse[p % i] * (p - int(p / i)) % p

def InverseofFactorial(p):
	factorialNumInverse[0] = factorialNumInverse[1] = 1
	for i in range(2, N + 1, 1):
		factorialNumInverse[i] = naturalNumInverse[i] * factorialNumInverse[i - 1] % p

def factorial(p):
	fact[0] = 1
	for i in range(1, N + 1):
		fact[i] = fact[i - 1] * i % p

def Binomial(N, R, p):
	ans = fact[N] * factorialNumInverse[R] % p * factorialNumInverse[N - R] % p
	return ans
p = 1000000007
InverseofNumber(p)
InverseofFactorial(p)
factorial(p)
t = int(input())
while t > 0:
	(n, l, r) = map(int, input().split())
	a = []
	for i in range(n + 1):
		x = Binomial(n, i, p)
		a.append(x)
		a.append(0)
	subarray = a[n + l:n + r + 1]
	for i in range(r - l + 1):
		print(subarray[i], end=' ')
	print(end='\n')
	t = t - 1


import functools
from math import factorial

def mod_exp(b, e, mod):
	r = 1
	while e > 0:
		if e & 1 == 1:
			r = r * b % mod
		b = b * b % mod
		e >>= 1
	return r

def fact_exp(n, p):
	e = 0
	u = p
	t = n
	while u <= t:
		e += t // u
		u *= p
	return e

def get_base_digits(n, b):
	d = []
	while n > 0:
		d.append(n % b)
		n = n // b
	return d

def fermat_binom_advanced(n, k, p):
	num_degree = fact_exp(n, p) - fact_exp(n - k, p)
	den_degree = fact_exp(k, p)
	if num_degree > den_degree:
		return 0
	if k > n:
		return 0
	num = 1
	for i in range(n, n - k, -1):
		cur = i
		while cur % p == 0:
			cur //= p
		num = num * cur % p
	denom = 1
	for i in range(1, k + 1):
		cur = i
		while cur % p == 0:
			cur //= p
		denom = denom * cur % p
	return num * mod_exp(denom, p - 2, p) % p

def lucas_binom(n, k, p):
	np = get_base_digits(n, p)
	kp = get_base_digits(k, p)
	binom = 1
	for i in range(len(np) - 1, -1, -1):
		ni = np[i]
		ki = 0
		if i < len(kp):
			ki = kp[i]
		binom = binom * fermat_binom_advanced(ni, ki, p) % p
	return binom
MOD = 10 ** 9 + 7
fact = [1]
invFact = [0] * (10 ** 6 + 1)
invFact[0] = invFact[1] = 1
for i in range(1, 10 ** 6 + 1):
	temp2 = fact[i - 1] * i
	temp2 %= MOD
	fact.append(temp2)
for i in range(2, 10 ** 6 + 1):
	invFact[i] = (MOD - MOD // i) * invFact[MOD % i] % MOD
for i in range(1, 10 ** 6 + 1):
	invFact[i] = invFact[i - 1] * invFact[i] % MOD

def ncr(n, r):
	return fact[n] * invFact[r] % MOD * invFact[n - r] % MOD

def solve(N, L, R):
	ans = []
	for index in range(L, R + 1):
		v = 0
		if N % 2 == 0:
			if abs(index) % 2 == 0:
				k = N // 2 + index // 2
				v = ncr(N, k)
		elif abs(index) % 2 == 1:
			k = N // 2 + (index + 1) // 2
			v = ncr(N, k)
		ans.append(str(v))
	print(' '.join(ans))
for T in range(int(input())):
	(N, L, R) = list(map(int, input().split()))
	solve(N, L, R)


def readInt():
	return int(input())

def readInts():
	return [int(x) for x in input().split()]

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

def readStrings():
	return input().split()
prime = 1000000007
factorials = [1]
for n in range(1, 1000001):
	factorials.append(factorials[-1] * n % prime)

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
	return (g, x - b // a * y, y)

def modinv(a, m):
	(g, x, y) = egcd(a, m)
	return x % m

def readCase():
	(n, l, r) = readInts()
	return (n, l, r)

def binomial(n, k):
	ans = factorials[n] * modinv(factorials[n - k], prime) * modinv(factorials[k], prime)
	return ans % prime

def solve(n, l, r):
	start = -n
	result = []
	if (l - start) % 2 != 0:
		result.append(0)
	k_start = (l - start + 1) // 2
	k_end = (r - start) // 2
	for k in range(k_start, k_end + 1):
		result.append(binomial(n, k))
		result.append(0)
	if (r - start) % 2 == 0:
		result.pop()
	print(' '.join((str(x) for x in result)))
cases = readInt()
for case in range(cases):
	solve(*readCase())


dp = [0 for i in range(10 ** 6 + 1)]
m = 10 ** 9 + 7

def inverse():
	dp[0] = dp[1] = 1
	for i in range(2, 10 ** 6 + 1):
		dp[i] = dp[m % i] * (m - m // i) % m

def combs(n, r):
	a = b = 1
	for i in range(r):
		a = a * (n - i) % m
		b = b * (i + 1) % m
	return a * pow(b, m - 2, m) % m

def calc(n, s, a, b):
	l = [s]
	for i in range(a, b):
		l.append(l[i - a] * (n - i) * dp[i + 1] % m)
	return l
inverse()
t = int(input())
for _ in range(t):
	(n, l, r) = [int(i) for i in input().split()]
	(a, b) = ((l + n) // 2, (r + n) // 2)
	lst = calc(n, combs(n, a), a, b)
	if n % 2 == 0:
		strt = 0
		if l & 1 == 1 and r & 1 == 1 and (l == r):
			print(0)
		else:
			if l & 1 == 1:
				print(0, end=' ')
				strt = 1
			print(*lst[strt:], sep=' 0 ', end=' ')
			if r & 1 == 1:
				print(0, end=' ')
			print()
	else:
		strt = 0
		if l & 1 == 0 and r & 1 == 0 and (l == r):
			print(0)
		else:
			if l & 1 == 0:
				print(0, end=' ')
				strt = 1
			print(*lst[strt:], sep=' 0 ', end=' ')
			if r & 1 == 0:
				print(0, end=' ')
			print()


import math

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def mod(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	return inv * a % m

def binomial(n, r):
	if r > n:
		return 0
	m = 1000000007
	inv = [0 for i in range(r + 1)]
	inv[0] = 1
	if r + 1 >= 2:
		inv[1] = 1
	for i in range(2, r + 1):
		inv[i] = m - m // i * inv[m % i] % m
	ans = 1
	for i in range(2, r + 1):
		ans = ans % m * (inv[i] % m) % m
	for i in range(n, n - r, -1):
		ans = ans % m * (i % m) % m
	return ans
t = int(input())
for _ in range(t):
	(n, l, r) = map(int, input().split())
	m = 1000000007
	if (n + l) % 2 == 0:
		x = binomial(n, (n + l) // 2)
	else:
		x = binomial(n, (n + l + 1) // 2)
	for i in range(l + n, r + n + 1):
		if i % 2 == 0:
			print(x, end=' ')
			x = mod(x * (n - i // 2), i // 2 + 1, m)
		else:
			print(0, end=' ')
	print('\n', end='')


m = 1000000007

def modinv(a, m):
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	dp = [1] * (n + 1)
	for i in range(1, n // 2 + 1):
		dp[i] = dp[i - 1] * (n - i + 1) % m * modinv(i, m)
		dp[n - i] = dp[i]
	ax = []
	for i in range(l, r + 1):
		if i < 0 and n & 1 == i & 1:
			ax.append(dp[(n + i) // 2] % m)
		elif i >= 0 and n & 1 == i & 1:
			ax.append(dp[(n - i) // 2] % m)
		else:
			ax.append(0)
	print(*ax)


MOD = 10 ** 9 + 7
LIM = 10 ** 6 + 1
fact = [1] * LIM
for i in range(1, LIM):
	fact[i] = fact[i - 1] * i % MOD

def C(n, r):
	den = fact[r] * fact[n - r] % MOD
	den = pow(den, MOD - 2, MOD)
	ans = fact[n] * den % MOD
	return ans

def Good(N, I):
	return N % 2 == I % 2

def fixR(n, i):
	return n // 2 - abs(i) // 2

def solve(N, L, R):
	li = []
	for i in range(L, R + 1):
		if not Good(N, i):
			li.append(0)
			continue
		r = fixR(N, i)
		li.append(C(N, r))
	print(*li)
for case in range(int(input())):
	(N, L, R) = map(int, input().split())
	solve(N, L, R)


def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def compute_row(n, mod):
	res = [1]
	for i in range(1, n + 1):
		x = res[-1] * ((n - i + 1) / i)
		x = round(x % mod)
		res.append(x)
	return res
mod = 10 ** 9 + 7
factorials = [1]
inv = []
inv.append(modInverse(factorials[-1], mod))
for i in range(10 ** 6):
	factorials.append(factorials[-1] * (i + 1) % mod)
	inv.append(modInverse(factorials[-1], mod))
for _ in range(int(input())):
	(n, l, r) = [int(x) for x in input().split()]
	top = [1]
	for i in range(n):
		top.append(top[-1] * (n - i) % mod)
	row = [1]
	for i in range(1, n + 1):
		row.append(top[i] * inv[i] % mod)
	ans = []
	for i in range(l, r + 1):
		if (n + i) % 2:
			ans.append('0')
		else:
			ans.append(str(row[(n + i) // 2]))
	print(' '.join(ans))


mod = 10 ** 9 + 7

def fun(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = fun(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a, m):
	(g, x, y) = fun(a, m)
	return x % m
for _ in range(int(input())):
	(n, left, right) = map(int, input().split())
	arr = []
	i = 0
	curr = 1
	r = 0
	while r <= n // 2:
		arr.append(curr)
		curr = curr * (n - r) % mod * modinv(r + 1, mod) % mod
		r += 1
		arr.append(0)
	if left >= 0:
		if n & 1:
			arr = arr[::-1]
		else:
			arr = arr[::-1][1:]
		print(*arr[left:right + 1])
	else:
		if n & 1:
			arr = arr + arr[::-1][1:]
		else:
			arr = arr + arr[::-1][3:]
		print(*arr[left + n:right + 1 + n])


try:
	from debug import debug, timer
except ImportError:
	pass
from sys import stdin
input = stdin.readline

def rii():
	return range(int(input().strip()))

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

def mii():
	return map(int, input().strip().split(' '))

def lmii():
	return list(map(int, input().strip().split(' ')))

def si():
	return str(input().strip())

def getvals():
	while True:
		yield from input().split()

def tri(n):
	return n * (n + 1) // 2

def smallest_first(m, n):
	return (min(m, n), max(m, n))
modulus = 10 ** 9 + 7

def p_to_k(n, p):
	return -1 if n - p & 1 else (n + p) // 2

def mod_exp(b, e, mod):
	return pow(b, e, mod)

def fermat_binom(n, k, p):
	if k > n:
		return 0
	num = 1
	for i in range(n, n - k, -1):
		num = num * i % p
	denom = 1
	for i in range(1, k + 1):
		denom = denom * i % p
	return num * mod_exp(denom, p - 2, p) % p

def fermat_compute(n, p):
	facts = [0 for _ in range(n + 1)]
	invfacts = [0 for _ in range(n + 1)]
	facts[0] = 1
	invfacts[0] = 1
	for i in range(1, n + 1):
		facts[i] = facts[i - 1] * i % p
		invfacts[i] = mod_exp(facts[i], p - 2, p)
	return (facts, invfacts)

def binom_pre_computed(facts, invfacts, n, k, p):
	return facts[n] * (invfacts[k] * invfacts[n - k] % p) % p

def solve(*args):
	(n, l, r) = args
	ans = list()
	(facts, invfacts) = fermat_compute(n, modulus)
	for idx in range(l, r + 1):
		pp = p_to_k(n, idx)
		if pp == -1:
			ans.append(0)
		else:
			ans.append(binom_pre_computed(facts, invfacts, n, pp, modulus))
	return ' '.join([str(x) for x in ans])

def do_codechef():
	for t in rii():
		(n, l, r) = mii()
		print(solve(n, l, r))
do_codechef()
exit()


import math

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def modDivide(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	return inv * a % m
t = int(input())
mod = 1000000007
while t > 0:
	ls = list(map(int, input().split(' ')))
	mx = max(abs(ls[1]), abs(ls[2]))
	com = [1]
	for i in range(1, ls[0] // 2 + 1):
		res = com[i - 1] * (ls[0] - i + 1)
		com.append(modDivide(res, i, mod))
	if ls[0] % 2 == 0:
		for i in range(ls[1], ls[2] + 1):
			if abs(i) % 2 == 1 or abs(i) // 2 >= len(com):
				print(0, end=' ')
			elif i == 0:
				print(com[-1], end=' ')
			else:
				print(com[len(com) - abs(i) // 2 - 1], end=' ')
	else:
		for i in range(ls[1], ls[2] + 1):
			if abs(i) % 2 == 0 or abs(i) // 2 >= len(com):
				print(0, end=' ')
			elif abs(i) == 1:
				print(com[-1], end=' ')
			else:
				print(com[len(com) - abs(i) // 2 - 1], end=' ')
	print()
	t -= 1


inv = [0 for i in range(1000000 + 1)]
inv[0] = 1
inv[1] = 1
m = 1000000007
for i in range(2, 1000001):
	inv[i] = m - m // i * inv[m % i] % m
for i in range(2, 1000001):
	inv[i] = inv[i - 1] % m * (inv[i] % m) % m

def nth(n):
	ans = 1
	r = n + 1
	arr = []
	arr.extend([1, 0])
	for i in range(n, 0, -1):
		ans = ans % m * (i % m) % m
		x = inv[r - i] % m * (ans % m) % m
		arr.extend([x, 0])
	return arr
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	pascal = nth(n)
	for i in range(abs(-n - l), abs(-r - n) + 1):
		print(pascal[i], end=' ')
	print()


m = 1000000007
N = 1000000
f = [1] * (N + 1)
for i in range(2, N + 1):
	f[i] = f[i - 1] * i % m

def ncr(n, r):
	if r == 0:
		return 1
	return f[n] * pow(f[r], m - 2, m) * pow(f[n - r], m - 2, m) % m
for _ in range(int(input())):
	arr = list(map(int, input().split()))
	n = arr[0]
	l = arr[1]
	r = arr[2]
	for i in range(l, r + 1):
		if i % 2 != n % 2:
			print('0', end=' ')
			continue
		print(ncr(n, (n - abs(i)) // 2), end=' ')
	print()


p = 1000000007

def fermat_compute(n):
	facts = [0] * n
	invfacts = [0] * n
	facts[0] = 1
	invfacts[0] = 1
	for i in range(1, n):
		facts[i] = facts[i - 1] * i % p
		invfacts[i] = pow(facts[i], p - 2, p)
	return (facts, invfacts)

def binom_pre_computed(facts, invfacts, n, k):
	return facts[n - 1] * (invfacts[k - 1] * invfacts[n - k] % p) % p

def isEven(n):
	if n % 2 == 0:
		return True
	return False
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	size = r - l + 1
	ans = [0 for _ in range(size)]
	(facts, invfacts) = fermat_compute(n + 1)
	i = 0
	while l < r + 1:
		if isEven(l + n):
			a = (l + n) // 2
			ans[i] = binom_pre_computed(facts, invfacts, n + 1, a + 1)
		i += 1
		l += 1
	print(' '.join(map(str, ans)))


import math
p = 10 ** 9 + 7

def nCr(n, r):
	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 modInverse(b):
	g = math.gcd(b, p)
	if g != 1:
		return -1
	else:
		return pow(b, p - 2, p)

def modDivide(a, b):
	a = a % p
	inv = modInverse(b)
	if inv == -1:
		return 0
	else:
		return inv * a % p
T = int(input())
for i in range(T):
	(N, L, R) = [int(x) for x in input().split()]
	if N % 2 == 0:
		for i in range(L, min(R + 1, L + 2)):
			if i % 2 == 0:
				r = (N - abs(i)) // 2
				x = nCr(N, r)
				print(x, end=' ')
			else:
				print(0, end=' ')
		for i in range(L + 2, R + 1):
			if i % 2 == 0 and i <= 0:
				r = (N - abs(i)) // 2
				y = x * ((N - r + 1) % p) % p
				x = modDivide(y, r)
				print(x, end=' ')
			elif i % 2 == 0 and i > 0:
				r = (N - abs(i)) // 2
				y = x * ((r + 1) % p) % p
				x = modDivide(y, N - r)
				print(x, end=' ')
			else:
				print(0, end=' ')
	else:
		for i in range(L, min(R + 1, L + 2)):
			if i % 2 != 0:
				r = (N - abs(i)) // 2
				x = nCr(N, r)
				print(x, end=' ')
			else:
				print(0, end=' ')
		for i in range(L + 2, R + 1):
			if i % 2 != 0 and i <= 0:
				r = (N - abs(i)) // 2
				y = x * ((N - r + 1) % p) % p
				x = modDivide(y, r)
				print(x, end=' ')
			elif i % 2 != 0 and i > 0:
				r = (N - abs(i)) // 2
				y = x * ((r + 1) % p) % p
				x = modDivide(y, N - r)
				print(x, end=' ')
			else:
				print(0, end=' ')
	print()


import sys
import math
input = sys.stdin.readline
MAXN = 10 ** 6
MOD = 10 ** 9 + 7
fact = [1]
for i in range(1, MAXN + 1):
	fact.append(fact[-1] * i % MOD)

def multinv(n, m):
	if m == 1:
		return 0
	(m0, y, x) = (m, 0, 1)
	while n > 1:
		(y, x) = (x - n // m * y, y)
		(m, n) = (n % m, m)
	return x + m0 if x < 0 else x

def choose(n, k, m):
	return fact[n] * multinv(fact[n - k] * fact[k] % m, m) % m

def fs(n, i):
	if n % 2 == 0 and abs(i) % 2 == 1:
		return 0
	if n % 2 == 1 and abs(i) % 2 == 0:
		return 0
	if n % 2 == 0:
		return choose(n, n // 2 + math.ceil(abs(i) / 2), MOD)
	if n % 2 == 1:
		return choose(n, n // 2 + math.ceil(abs(i) / 2), MOD)
T = int(input())
for j in range(T):
	(n, l, r) = map(int, input().split())
	res = [fs(n, abs(i)) for i in range(l, r + 1)]
	print(*res)


M = 1000000007

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def getNCR(n, r):
	if r > n:
		print(0)
	else:
		res = 1
		for i in range(r):
			res = res % M * ((n - i) % M) % M * modInverse(i + 1, M) % M
	return res
for _ in range(int(input())):
	(N, L, R) = map(int, input().split())
	n = N
	diff = R - L + 1
	l = []
	flag = 0
	for i in range(L, R + 1):
		if (i + N) % 2 == 0:
			if flag == 1:
				res = res % M * ((N - r) % M) % M * modInverse(r + 1, M) % M
				l.append(res)
				r = (i + N) // 2
			else:
				r = (i + N) // 2
				res = getNCR(N, r)
				l.append(res)
				flag = 1
		else:
			l.append(0)
	for i in range(len(l)):
		print(l[i], end=' ')
	print('\n')


t = int(input())
for _ in range(t):
	(n, l, r) = list(map(int, input().split()))
	row = [1]
	prev = 1
	m = 10 ** 9 + 7
	for i in range(1, n + 1):
		curr = prev * (n + 1 - i) % m
		inv_i = pow(i, m - 2, m)
		curr = curr * inv_i % m
		row.append(0)
		row.append(curr)
		prev = curr
	l = n + l
	r = n + r
	r += 1
	for i in row[l:r]:
		print(i, end=' ')
	print()


import sys
MYPC = False
if MYPC:
	sys.stdin = open('in.txt', 'r')
	sys.stdout = open('out.txt', 'w')
input = lambda : sys.stdin.readline().strip('\r\n')
mod = 1000000007

def gcd_tuple(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = gcd_tuple(b % a, a)
		return (g, x - b // a * y, y)

def inv_mod(a, m=mod):
	(g, x, y) = gcd_tuple(a, m)
	if g != 1:
		return -1
	return x % m

def solve():
	(n, l, r) = map(int, input().split())
	l += n
	r += n
	(coeff, R) = (1, 0)
	coeffs = [0] * (2 * n + 1)
	for i in range(0, 2 * n + 1, 2):
		coeffs[i] = coeff
		R += 1
		factor = (n - R + 1) * inv_mod(R)
		factor %= mod
		coeff *= factor
		coeff %= mod
	print(*[coeffs[i] for i in range(2 * n + 1) if l <= i <= r])

def main() -> None:
	for _ in range(int(input())):
		solve()
main()


import math
maxN = 10 ** 6 + 1
facNumInv = [None] * (maxN + 1)
NumInv = [None] * (maxN + 1)
fac = [None] * (maxN + 1)

def InvofNum(p):
	NumInv[0] = 1
	NumInv[1] = 1
	for i in range(2, maxN + 1, 1):
		NumInv[i] = NumInv[p % i] * (p - int(p / i)) % p

def InvofFac(p):
	facNumInv[0] = 1
	facNumInv[1] = 1
	for i in range(2, maxN + 1, 1):
		facNumInv[i] = NumInv[i] * facNumInv[i - 1] % p

def factorial(p):
	fac[0] = 1
	for i in range(1, maxN + 1):
		fac[i] = fac[i - 1] * i % p

def nCrmodp(n, r, p):
	ans = fac[n] * facNumInv[r] % p * facNumInv[n - r] % p
	return ans
p_ = 10 ** 9 + 7
InvofNum(p_)
InvofFac(p_)
factorial(p_)
T = int(input())
for i in range(T):
	(N, L, R) = map(int, input().split())
	A = list(range(N + L, N + R + 1))
	a = []
	for j in A:
		if j % 2 == 0 and j >= 0 and (j <= 2 * N):
			a.append(nCrmodp(N, int(j / 2), p_))
		else:
			a.append(0)
	print(*a, sep=' ')


mod = 1000000007

def modinv(a):
	(x, y) = (1, 0)
	m = mod
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x += mod
		x %= mod
	return x

def mulmod(a, b):
	return a * b % mod

def cal(ncr, n):
	for i in range(1, n // 2 + 1):
		ncr[i] = mulmod(ncr[i - 1], n - i + 1)
		ncr[i] = mulmod(ncr[i], modinv(i))
for _ in range(int(input())):
	(n, l, r) = map(int, input().split())
	ncr = [1 for i in range(n)]
	cal(ncr, n)
	res = list()
	temp = n // 2
	if n % 2 == 1:
		temp += 1
	for i in range(0, temp):
		res.append(ncr[i])
		res.append(0)
	for i in range(n // 2, -1, -1):
		res.append(ncr[i])
		res.append(0)
	if n == 1:
		print(*[1, 0, 1][l + 1:r + 2])
	else:
		print(*res[l + n:r + n + 1])


m = 10 ** 9 + 7
fact = [1, 1]
for i in range(2, 10 ** 6):
	v = i * fact[i - 1]
	fact.append(v % m)

def com(n, i):
	no = fact[n]
	de = fact[i] * fact[n - i]
	de = pow(de, m - 2, m)
	return no * de % m
for i in range(int(input())):
	(n, l, r) = map(int, input().split())
	for i in range(l + n, r + n + 1):
		if i % 2 == 0:
			print(com(n, i // 2), end=' ')
		else:
			print(0, end=' ')
	print()