Read problems statements in [Russian] and [Bengali].

You are given an integer N. Output a permutation of values from 1 to N that satisfies the following condition:

\gcd([1+A_{1},2+A_{2},3+A_{3},\ldots,N+A_{N}]) > 1

It can be proven that a solution always exists. If there are multiple permutations that can satisfy the condition, then output any one of them.

As a reminder,
A permutation of values from 1 to N is an array containing integers from 1 to N in any order but each of them appearing exactly once.
GCD stands for Greatest Common Divisor. The greatest common divisor of a sequence is the largest integer d such that all the numbers in sequence are divisible by d. For more information, refer to [here].

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

- The first line contains an integer T denoting the number of test cases. The T test cases then follow.
- The first line of each test case contains an integer N.

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

For each test case, output on one line a permutation of values from 1 to N which satisfies the above condition.

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

$1 ≤ T ≤ 500$
$2 ≤ N ≤ 500$

----- Sample Input 1 ------ 
1
4

----- Sample Output 1 ------ 
3 4 1 2
----- explanation 1 ------ 
- For the first test case, $\gcd([1+3,2+4,3+1,4+2])= \gcd([4,6,4,6])=2$ which is greater than $1$, so the given permutation satisfies the condition.

Source: codechef | Difficulty: EASY
Tags: Number theory

Constructive algorithms

Mathematics

Ad-hoc


Solutions:
for _ in range(int(input())):
	n = int(input())
	for i in range(n, 0, -1):
		print(i, end=' ')
	print()


for _ in range(int(input())):
	ans = list(range(1, int(input()) + 1))
	print(*ans)


for i in range(int(input())):
	n = int(input())
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


t = int(input())
for t in range(t):
	n = int(input())
	arr = []
	for i in range(n, 0, -1):
		print(str(i), end=' ')


for t in range(int(input())):
	k = int(input())
	for i in range(1, k + 1):
		print(i, end=' ')


a = int(input(''))
for i in range(a):
	x = int(input(''))
	for j in range(1, x + 1):
		print(j, end=' ')


for _ in range(int(input())):
	n = int(input())
	for j in range(1, n + 1):
		print(j, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(1, n + 1):
		print(j, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(str(i))
	print(' '.join(l))


t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	for j in range(1, n + 1):
		ans.append(j)
	print(*ans)


t = input()
for c in range(0, int(t)):
	n = input()
	out = ''
	odd = 1
	even = 2
	for x in range(1, int(n) + 1):
		if x % 2 == 1:
			out = out + str(odd) + ' '
			odd = odd + 2
		else:
			out = out + str(even) + ' '
			even = even + 2
	print(out)


for _ in range(int(input())):
	n = int(input())
	res = [int(j) for j in range(1, n + 1)]
	print(*res)


tests = int(input())
for i in range(tests):
	num = int(input())
	ans = []
	for j in range(1, num + 1):
		ans.append(j)
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	l = list(range(1, n + 1))
	print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(1, n + 1):
		print(i, end=' ')


tc = int(input())
for _ in range(tc):
	n = int(input())
	lo = []
	for w in range(n):
		lo.append(w + 1)
	print(*lo)


t = int(input())
while t:
	t -= 1
	n = int(input())
	res = [i for i in range(1, n + 1)]
	for i in range(len(res)):
		print(res[i], end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	print(' '.join([str(i) for i in range(1, n + 1)]))


for i in range(int(input())):
	print(' '.join((str(x + 1) for x in range(int(input())))))


for i in range(int(input())):
	l = []
	n = int(input())
	for i in range(1, n + 1):
		l.append(i)
	print(*l)


for _ in range(int(input())):
	s = int(input())
	for i in range(1, s + 1):
		print(i, end=' ')


for t in range(int(input())):
	print(*[x + 1 for x in range(int(input()))[::-1]])


t = int(input())
for _ in range(t):
	n = int(input())
	l = [i for i in range(1, n + 1)]
	print(*l)


n = int(input())
while n > 0:
	n -= 1
	m = int(input())
	l = [int(x) for x in range(1, m + 1)]
	print(*l)


t = int(input())
while t > 0:
	n = int(input())
	for i in range(1, n + 1):
		print(n + 1 - i, end=' ')
	t = t - 1


test = int(input())
for i in range(test):
	n = int(input())
	a = []
	for j in range(1, n + 1):
		a.append(j)
	print(*a)


T = int(input())
for tj in range(T):
	N = int(input())
	for i in range(1, N + 1):
		print(i, end=' ')
	print()


T = int(input())
for _ in range(T):
	n = int(input())
	for i in range(n):
		print(i + 1, end=' ')
	print()


s = int(input())
for i in range(s):
	a = int(input())
	for k in range(a):
		print(k + 1, end=' ')