The Little Elephant enjoys recursive functions.

This time he enjoys the sorting function. Let a is a permutation of an integers from 1 to n, inclusive, and ai denotes the i-th element of the permutation. The Little Elephant's recursive function f(x), that sorts the first x permutation's elements, works as follows:

  * If x = 1, exit the function. 
  * Otherwise, call f(x - 1), and then make swap(ax - 1, ax) (swap the x-th and (x - 1)-th elements of a). 



The Little Elephant's teacher believes that this function does not work correctly. But that-be do not get an F, the Little Elephant wants to show the performance of its function. Help him, find a permutation of numbers from 1 to n, such that after performing the Little Elephant's function (that is call f(n)), the permutation will be sorted in ascending order.

Input

A single line contains integer n (1 ≤ n ≤ 1000) — the size of permutation.

Output

In a single line print n distinct integers from 1 to n — the required permutation. Numbers in a line should be separated by spaces.

It is guaranteed that the answer exists.

Examples

Input

1


Output

1 

Input

2


Output

2 1

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
n = int(input())
l = list(range(1, n + 1))
l = sorted(l)
l.insert(0, l[-1])
l.pop()
print(*l)


n = int(input())
print(' '.join([str(n) if x == 0 else str(x) for x in range(0, n)]))


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


def main():
	n = int(input())
	data = list(range(1, n + 1))
	data.sort()
	data.pop()
	data.insert(0, n)
	for j in data:
		print(j, end=' ')
main()


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = int(input())
sys.stdout.write(str(n) + ' ')
for i in range(1, n):
	sys.stdout.write(str(i) + ' ')


n = int(input())
print(n, *[i for i in range(1, n)])


a = int(input())
print(a)
for i in range(1, a):
	print(i)


n = int(input())
print(n, end=' ')
print(*range(1, n))


n = int(input())
A = [n]
for i in range(1, n):
	A.append(i)
for i in A:
	print(i, end=' ')


n = int(input())
a = [i for i in range(1, n)]
a.insert(0, n)
print(*a[0:n])


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


n = int(input())
l = []
for i in range(1, n + 1, 1):
	l.sort()
	l = [i] + l
for i in l:
	print(i, end=' ')
print()


d = int(input())
print(d)
for i in range(1, d):
	print(i)


def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def main():
	n = int(input())
	if n == 1:
		print(n)
	else:
		sequence = [str(x) for x in range(1, n + 1)]
		i = n - 1
		while i > 0:
			(sequence[i], sequence[i - 1]) = swap(sequence[i], sequence[i - 1])
			i -= 1
		sequence = ' '.join(sequence)
		print(sequence)
main()


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


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


a = int(input())
b = []
for i in range(1, a):
	b.append(str(i))
print(a, *b)


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


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


l = [int(i) for i in range(1, int(input()) + 1)]
p = [l[-1]] + l[:-1]
print(*p)


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


n = int(input())
a = str(n)
for i in range(n - 1):
	a += ' ' + str(i + 1)
print(a)


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


N = int(input())
print(1 if N == 1 else N, *[i for i in range(1, N)])


n = int(input())
a = [n] + list(range(1, n))
print(*a)


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


a = int(input())
print(a, end=' ')
if a > 1:
	print(' '.join(map(str, range(1, a))))


import sys, os, io, time, copy
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import math

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


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


n = int(input())
perm = [i for i in range(1, n + 1)]
if n == 1:
	print(1)
else:
	ans = [perm[-1]] + perm[0:n - 1]
	ans = [str(i) for i in ans]
	print(' '.join(ans))


n = int(input())
arr = []
arr.append(n)
for i in range(1, n):
	arr.append(i)
for i in range(n):
	print(arr[i], end=' ')


def my_fun(n):
	a = [n]
	for i in range(1, n):
		a.append(i)
	return a
print(*my_fun(int(input())))


def LittleElephantAndFunction(n):
	result = str(n)
	i = 1
	while i < n:
		result += ' '
		result += str(i)
		i += 1
	return result
n = int(input())
print(LittleElephantAndFunction(n))


n = int(input())
s = str(n) + ' ' + ' '.join(list(map(str, list(range(1, n)))))
print(s)


n = int(input())
arr = [x for x in range(1, n)]
arr.insert(0, n)
print(*arr)


n = int(input())
a = [str(i) for i in range(1, n + 1)]
while n != 1:
	temp = a[n - 1]
	a[n - 1] = a[n - 2]
	a[n - 2] = temp
	n -= 1
print(' '.join(a))


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


N = int(input())
print(N, *[i for i in range(1, N)])


n = int(input())
print(n, ' '.join(map(str, range(1, n))))


from sys import *
inp = lambda : stdin.readline()

def main():
	n = int(inp())
	print(n, end=' ')
	for i in range(1, n):
		print(i, end=' ')
main()


try:
	n = int(input())
	print(n, end=' ')
	for i in range(1, n):
		print(i, end=' ')
except EOFError:
	pass


def f(l, n):
	if n == 0:
		return
	f(l, n - 1)
	(l[n - 1], l[n]) = (l[n], l[n - 1])
	return
n = int(input())
l = list(range(1, n + 1))
f(l, n - 1)
s = list(range(1, n + 1))
for (i, x) in enumerate(l, 1):
	s[x - 1] = i
print(*s, end=' ')


def readln():
	return tuple(map(int, input().split()))
(n,) = readln()
print(*tuple([n] + list(range(1, n))))


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right
from collections import deque

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

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

def I():
	return int(stdin.readline())
P = 1000000007
n = I()
if n == 1:
	print(1)
else:
	print(n, end=' ')
	for i in range(1, n):
		print(i, end=' ')


import sys
n = int(input())
sys.stdout.write(str(n) + ' ')
for i in range(1, n):
	sys.stdout.write(str(i) + ' ')


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


a = int(input())
b = list(range(1, a + 1))
x = b[a - 1]
print(x, end=' ')
del b[a - 1]
print(*b)


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


n = int(input())
p = [n] + list(range(1, n))
for x in p:
	print(x, end=' ')


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


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


def main():
	n = int(input())
	if n == 1:
		print(1)
	else:
		A = [n]
		B = [x for x in range(1, n)]
		C = A + B
		print(*C)
main()


def f(x):
	print(x, end=' ')
	print(*[x for x in range(1, x)])
f(int(input()))


import sys
import math
n = int(sys.stdin.readline())
a = []
a.append(str(n))
for i in range(1, n):
	a.append(str(i))
print(' '.join(a))


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


def calc(s):
	a = [*range(1, s + 1)]

	def rec(x):
		if x == 0:
			return
		rec(x - 1)
		(a[x - 1], a[x]) = (a[x], a[x - 1])
	end = a.pop(-1)
	a = [end] + a
	return ' '.join([str(x) for x in a])
s = int(input())
print(calc(s))


N = int(input())
print(N, *range(1, N))


i = int(input())
res = str(i)
for j in range(1, i):
	res = res + ' ' + str(j)
print(res)


n = int(input())
for x in range(n):
	if x == 0:
		print(n, end=' ')
	else:
		print(x, end=' ')


from collections import defaultdict

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


N = int(input())
ans = [N]
for i in range(1, N):
	ans.append(i)
print(*ans)


import sys
n = int(input())
res = list(range(1, n))
res.insert(0, n)
print(' '.join(map(str, res)))


t = int(input())
print(t, end=' ')
for x in range(1, t):
	print(x, end=' ')


def fun(x):
	print(x, end=' ')
	for i in range(1, x):
		print(i, end=' ')
x = int(input())
if x > 1:
	fun(x)
else:
	print(1)


z = int(input())
print(z, *(i for i in range(1, z)))


def fun(a, x):
	if x == 1:
		return a
	else:
		fun(a, x - 1)
		(a[x], a[x - 1]) = (a[x - 1], a[x])
n = int(input())
a = [i for i in range(0, n)]
a.insert(1, n)
for i in range(1, n + 1):
	print(a[i], end=' ')


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


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


n = int(input())
a = list(range(1, n))
print(n, end=' ')
print(*a, sep=' ')


def main(i):
	if i == 1:
		return 1
	s = [i] + list(range(1, i))
	return ' '.join(map(str, s))
print(main(int(input())))


n = int(input())
if n == 1:
	print(1)
	exit()
print(*[n] + list(range(1, n)))


n = int(input())
a = [i for i in range(1, n)]
if n > 1:
	a = [n] + a
	print(*a)
else:
	print(1)


n = int(input())
a = [i for i in range(1, n + 1)]
for i in range(n - 1, 0, -1):
	temp = a[i]
	a[i] = a[i - 1]
	a[i - 1] = temp
print(*a)


x = int(input())

def solve(x):
	if x == 1:
		print(1)
	elif x == 2:
		print('2 1')
	else:
		y = [z for z in range(1, x)]
		print(x, *y)
solve(x)


a = int(input())
string = str(a)
string += ' '
for i in range(1, a):
	string += str(i)
	string += ' '
print(string.strip())


n = int(input())
ans = [n] + list(range(1, n))
print(*ans)


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


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


n = int(input())
print(n, ' '.join(list((str(i) for i in range(1, n)))))


n = int(input())
X = [i + 1 for i in range(n)]
for i in range(n - 1, 0, -1):
	(X[i], X[i - 1]) = (X[i - 1], X[i])
for x in X:
	print(x, end=' ')


import sys
n = int(sys.stdin.readline())
answer = [str((i + n - 1) % n + 1) for i in range(n)]
sys.stdout.write(' '.join(answer))


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	arr = [x for x in range(1, n + 1)]
	arr = [arr[-1]] + arr[:n - 1]
	for x in arr:
		stdout.write(str(x) + ' ')
main()


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


n = int(input())
print(n, *range(1, n), sep=' ')


import sys

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

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

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
a = [n]
if n == 1:
	print(1)
else:
	for i in range(1, n):
		a.append(i)
	print(*a)


N = int(input())
print(N, end=' ')
for i in range(1, N - 1):
	print(i, end=' ')
if N != 1:
	print(N - 1)
2


n = int(input())
array = [i for i in range(1, n + 1)]

def calc(arr: list, x: int):
	global n
	if x == n - 1:
		return
	else:
		calc(arr, x + 1)
		(arr[x], arr[x + 1]) = (arr[x + 1], arr[x])
calc(array, 0)
print(*array)


n = int(input())
if n == 1:
	print('1')
else:
	array = [x for x in range(1, n)]
	array = [n] + array
	print(*array)


n = int(input())
print(' '.join([str((it - 1) % n + 1) for it in range(n)]))


def main():
	n = int(input())
	l = list(range(n))
	l[0] = n
	print(*l)
main()


n = int(input())
x = [n]
for i in range(1, n):
	x.append(i)
for i in x:
	print(i, end=' ')


n = int(input())
a = [i + 1 for i in range(n)]
if n == 1:
	print(1)
else:
	print(str(n) + ' ' + ' '.join((str(x) for x in a[:-1])))


import sys
n = int(input())
ans = list(range(2, n + 1))
ans.append(1)
for i in range(n):
	ans[i] += n - 2
	ans[i] %= n
	if ans[i] == 0:
		ans[i] = n
print(*ans)


n = int(input())
from itertools import permutations as pem
List = [str(x) for x in range(1, n)]
a = ' '.join(List)
print(n, a)


n = int(input())

def func(arr, n):
	if n == 0:
		return
	func(arr, n - 1)
	(arr[n], arr[n - 1]) = (arr[n - 1], arr[n])
print(n, *list(range(1, n)))


num = int(input())
final = [num]
for i in range(1, num):
	final.append(i)
for i in range(0, len(final)):
	final[i] = str(final[i])
fstring = ' '.join(final)
print(fstring)


n = int(input())
res = [i for i in range(1, n + 1)]
i = n - 1
while i != 0:
	(res[i], res[i - 1]) = (res[i - 1], res[i])
	i -= 1
print(*res)


n = int(input())
numbers = [x for x in range(1, n)]
numbers.insert(0, n)
print(' '.join(map(str, numbers)))


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


__author__ = 'Esfandiar'
n = int(input())
print(n, *range(1, n))


def elephant(n):
	ans = []
	ans.append(n)
	for i in range(1, n):
		ans.append(i)
	return ans
n = int(input())
print(*elephant(n))


a = input()
c = int(a)
print(a)
i = 1
while i < c:
	print(i)
	i = i + 1


import sys
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2, 1)
else:
	a = [n, 1]
	for i in range(2, n):
		a.append(i)
	print(*a)


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


n = int(input())
res = []
for i in range(1, n):
	res.append(i)
res.insert(0, n)
for ele in res:
	print(ele, end=' ')


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


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


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


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


__copyright__ = ''
__author__ = 'Son-Huy TRAN'
__email__ = 'sonhuytran@gmail.com'
__doc__ = ''
__version__ = '1.0'

def main() -> int:
	n = int(input())
	result = [str(n)] + [str(i) for i in range(1, n)]
	print(' '.join(result))
	return 0
exit(main())


def f(l):
	return [n] + list(range(1, n))
n = int(input())
print(*f(n))


n = int(input())
l = []
sr = []
for i in range(1, n + 1):
	l.append(i)
	if i == n:
		sr = sorted(l)
		sr.insert(0, n)
		del sr[-1]
print(*sr)


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


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


x = int(input())
if x == 1:
	print(x)
else:
	l = []
	for i in range(1, x + 1):
		l.append(str(i))
	l2 = []
	l2.append(l[-1])
	l.pop(len(l) - 1)
	for i in l:
		l2.append(i)
	for j in l2:
		print(j, end=' ')


a = [int(i) for i in range(1, int(input()) + 1)]
print(max(a), *a[0:len(a) - 1])


n = int(input())
l_x = [n] + [i + 1 for i in range(n - 1)]
print(' '.join((str(x) for x in l_x)))


def Ele(n):
	if n == 1:
		print('1')
		return
	else:
		print(n, end=' ')
		for i in range(1, n):
			print(i, end=' ')
Ele(int(input()))


n = int(input())
a = []
a.append(n)
i = 1
while i < n:
	a.append(i)
	i += 1
print(*a, sep=' ')


def solve(n):
	if n <= 2:
		return reversed(range(1, n + 1))
	return [n] + list(range(1, n))

def main():
	n = int(input())
	print(*solve(n))
main()


y = int(input())
lst = list(range(1, y + 1))
lst.pop(y - 1)
lst.insert(0, y)
for elem in lst:
	print(elem, ' ', end='')


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


n = int(input())
out = []
out.append(n)
for i in range(1, n):
	out.append(i)
for i in out:
	print(i, end=' ')


s = str(input())
answer = []
for i in range(int(s)):
	answer.append(i + 1)
if len(answer) == 1:
	print(answer[0])
else:
	k = str(answer[int(s) - 1]) + ' '
	for i in range(len(answer) - 1):
		k += str(answer[i])
		k += ' '
	print(k)


n = int(input())
print(n, end='')
if n == 1:
	print()
else:
	print(end=' ')
print(*range(1, n), sep=' ')


n = int(input())
x = [n]
a = [i for i in range(1, n)]
x.extend(a)
print(*x)


n = int(input())
a = list(range(1, n + 1))
for i in range(n - 1):
	(a[i], a[-1]) = (a[-1], a[i])
print(*a)


from sys import stdin
n = int(stdin.readline().rstrip('\n'))
if n == 1:
	print('1')
else:
	print(n, end=' ')
	for i in range(1, n):
		print(i, end=' ')
	print('')


a = int(input())
l = [i + 1 for i in range(a)]
s = str(l[-1])
for i in range(a - 1):
	s = s + ' ' + str(l[i])
print(s)


n = int(input())
A = [i for i in range(1, n + 1)]
B = [0] * len(A)
B[0] = A[-1]
print(B[0], end=' ')
for j in range(len(A) - 1):
	print(A[j], end=' ')


def mycode():
	n = input()
	if n == '1':
		print(1)
		return
	answer = n + ' '
	for i in range(1, int(n)):
		answer += str(i) + ' '
	print(answer)
mycode()


from collections import deque
n = int(input())
l = deque()
for i in range(1, n):
	l.append(i)
l.appendleft(n)
print(*l)


n = int(input())
l = []
for i in range(1, n + 1):
	if i == 1:
		l.append(n)
	else:
		l.append(i - 1)
for j in range(len(l)):
	print(l[j], end=' ')


n = int(input())
lst = []
for i in range(1, n + 1):
	lst.append(i)
lst.reverse()
print(lst[0], end=' ')
for j in lst[1:][::-1]:
	print(j, end=' ')


n = int(input())
ans = [i for i in range(n)]
ans[0] += n
print(' '.join(map(str, ans)))


a = int(input())
b = [i for i in range(1, a + 1)]
c = b.pop()
b = [c] + b
ans = ''
for i in b:
	ans = ans + str(i) + ' '
print(ans)


x = int(input())
perm = [str(x), *(str(i) for i in range(1, x))]
print(' '.join(perm))


from collections import deque
n = int(input())
if n == 1:
	print(1)
else:
	r = list(range(1, n + 1))
	m = deque(r)
	m.rotate(1)
	print(*m)


a = int(input())
l = []
i = 1
while i <= a:
	l.append(str(i))
	i += 1
i = a - 1
while i > 0:
	(l[i], l[i - 1]) = (l[i - 1], l[i])
	i -= 1
print(' '.join(l))


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	A = [0] * n
	for i in range(n):
		A[i] = i + 1
	for i in range(n - 1, 0, -1):
		A = sorted(A[:i + 1]) + A[i + 1:]
		(A[i], A[i - 1]) = (A[i - 1], A[i])
	print(' '.join(list((str(a) for a in A))))
main()


from sys import stdin
n = int(stdin.readline())
ar = [i for i in range(n, 0, -1)]
print(*ar[:1] + sorted(ar[1:]))


n = int(input())
arr = list(range(1, n))
print(n, *arr)


def gint():
	return int(input())

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

def gfloat():
	return float(input())

def gfloat_arr():
	return list(map(float, input().split()))

def pair_int():
	return map(int, input().split())
INF = 1 << 31
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
n = gint()
print(n, *range(1, n))


a = int(input())
print(' '.join(map(str, [a] + [x for x in range(1, a)])))


n = int(input())
if n <= 2:
	a = [i for i in range(1, n + 1)]
	a.sort(reverse=True)
	print(*a)
else:
	a = [i for i in range(1, n)]
	a.insert(0, n)
	print(*a)


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s)])

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

def def_value():
	return False
n = inp()
print(n, end=' ')
for i in range(1, n):
	print(i, end=' ')