Bike is interested in permutations. A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] is not.

A permutation triple of permutations of length n (a, b, c) is called a Lucky Permutation Triple if and only if <image>. The sign ai denotes the i-th element of permutation a. The modular equality described above denotes that the remainders after dividing ai + bi by n and dividing ci by n are equal.

Now, he has an integer n and wants to find a Lucky Permutation Triple. Could you please help him?

Input

The first line contains a single integer n (1 ≤ n ≤ 105).

Output

If no Lucky Permutation Triple of length n exists print -1.

Otherwise, you need to print three lines. Each line contains n space-seperated integers. The first line must contain permutation a, the second line — permutation b, the third — permutation c.

If there are multiple solutions, print any of them.

Examples

Input

5


Output

1 4 3 2 0
1 0 2 4 3
2 4 0 1 3


Input

2


Output

-1

Note

In Sample 1, the permutation triple ([1, 4, 3, 2, 0], [1, 0, 2, 4, 3], [2, 4, 0, 1, 3]) is Lucky Permutation Triple, as following holds:

  * <image>; 
  * <image>; 
  * <image>; 
  * <image>; 
  * <image>. 



In Sample 2, you can easily notice that no lucky permutation triple exists.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Constructive algorithms


Solutions:
r = int(input())
if r % 2 == 0:
	print(-1)
elif r == 1:
	print(0)
	print(0)
	print(0)
else:
	for i in range(r):
		print(i, end=' ')
	print()
	i = r - 1
	while i >= 0:
		print(i, end=' ')
		i -= 2
	i = r - 2
	while i >= 0:
		print(i, end=' ')
		i -= 2
	print()
	for i in range(r - 1, -1, -1):
		print(i, end=' ')


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	nums = [i for i in range(n)]
	a = [0] * n
	b = [0] * n
	c = [0] * n
	for i in range(n):
		a[i] = nums[i]
		b[i] = nums[i - 1]
		c[i] = (a[i] + b[i]) % n
	print(*a)
	print(*b)
	print(*c)


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	for i in range(2):
		for j in range(n):
			print(j, end=' ')
		print()
	for i in range(n):
		print(2 * i % n, end=' ')


from sys import stdin
from collections import defaultdict
import sys
sys.setrecursionlimit(15000)
n = int(stdin.readline().strip())
if n % 2:
	for i in range(n):
		print(i, end=' ')
	print()
	for i in range(n):
		print(i, end=' ')
	print()
	for i in range(n):
		print(2 * i % n, end=' ')
else:
	print(-1)
	exit()


n = int(input())
if n & 1:
	p = [*range(n)]
	for i in p:
		print(i, end=' ')
	print()
	for i in p:
		print(i, end=' ')
	print()
	for i in p:
		print(2 * i % n, end=' ')
else:
	print(-1)


a = int(input())
if a % 2 == 0:
	print(-1)
elif a == 1:
	print('0\n0\n0')
else:
	z = [*range(a - 1, -1, -1)]
	z1 = [a - 2] + [*range(a - 3, -1, -1)] + [a - 1]
	print(*z)
	print(*z1)
	for i in range(a):
		print((z[i] + z1[i]) % a, end=' ')


def prnt(j):
	for i in range(j):
		print(i, end=' ')
	print()
	return

def triplet(n):
	if n % 2 != 0:
		prnt(n)
		prnt(n)
		for i in range(n):
			num = i + i
			if num >= n:
				num = num - n
			print(num, end=' ')
	else:
		print('-1')
n = int(input())
triplet(n)


from itertools import permutations

def isOdd(n):
	return n | 1 == n

def matrixAdd(a, b):
	ans = []
	for (x, y) in zip(a, b):
		ans.append((x + y) % len(a))
	return ans

def printMatrix(arr):
	for i in arr:
		print(i, end=' ')
	print()

def main():
	inp = int(input())
	if not isOdd(inp):
		print(-1)
	else:
		x = [i for i in range(inp)]
		y = [i + 1 for i in range(inp)]
		y[-1] = 0
		printMatrix(x)
		printMatrix(y)
		printMatrix(matrixAdd(x, y))
main()


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


n = int(input())
if n % 2 == 0:
	print('-1')
else:
	a = range(n)
	print(' '.join(map(str, a)))
	print(' '.join(map(str, a)))
	print(' '.join(map(lambda x: str((x[0] + x[1]) % n), zip(a, a))))


n = int(input())
if n % 2 == 0:
	print(-1)
	exit()
print(*range(n))
print(*range(n))
res = []
for i in range(n):
	res += [2 * i % n]
print(*res)


n = int(input())
if n % 2 == 0:
	print('-1')
else:
	A = []
	C = []
	for i in range(n):
		A.append(i)
		C.append(2 * i % n)
	print(*A)
	print(*A)
	print(*C)


a = int(input())
if a % 2 == 0:
	print(-1)
else:
	print(*[*range(a)], '\n', *[*range(a)], '\n', *[2 * i % a for i in range(a)])


n = int(input())
a = [i for i in range(n)]
b = [(i + 1) % n for i in range(n)]
if n % 2 == 1:
	for i in range(n):
		print(a[i], end=' ')
	print()
	for i in range(n):
		print(b[i], end=' ')
	print()
	for i in range(n):
		print((a[i] + b[i]) % n, end=' ')
	print()
else:
	print(-1)


n = int(input())
if n == 1:
	print(0)
	print(0)
	print(0)
elif n % 2:
	(perm1, perm2) = ([], [])
	for i in range(n // 2 + 1, -1, -1):
		perm1.append(i)
	for i in range(n - 1, n // 2 + 1, -1):
		perm1.append(i)
	for i in range(n):
		if i < perm1[i]:
			perm2.append(n + i - perm1[i])
		elif i == perm1[i]:
			perm2.append(0)
		else:
			perm2.append(i - perm1[i])
	print(' '.join(map(str, perm1)))
	print(' '.join(map(str, perm2)))
	print(' '.join((str(i) for i in range(n))))
else:
	print(-1)


from sys import stdin as read
from sys import stdout as out
n = int(read.readline())
if n % 2 == 0:
	out.write('-1')
else:
	res = ' '.join(map(str, range(n)))
	out.write(res + '\n')
	out.write(res + '\n')
	out.write(' '.join(map(str, [(i + i) % n for i in range(n)])))


n = int(input())
arr = [i for i in range(n)]
ans = []
for i in range(n):
	ans.append(2 * i % n)
if sorted(ans) != arr:
	print(-1)
else:
	print(*arr)
	print(*arr)
	print(*ans)


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	print(*range(n))
	print(*range(1, n), 0)
	print(*range(1, n, 2), *range(0, n, 2))


import sys
import math
import collections
import bisect

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

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

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	n = int(input())
	if n % 2 == 0:
		print(-1)
		continue
	arr1 = [x for x in range(n)]
	arr2 = [x for x in range(1, n)]
	print(*arr1)
	arr2.append(0)
	print(*arr2)
	ans = []
	for i in range(n):
		ans.append((arr1[i] + arr2[i]) % n)
	print(*ans)


def pri(var):
	print(var, end=' ')
n = int(input())
if n % 2 == 0:
	print(-1)
	exit()
if n == 1:
	print('0\n0\n0')
	exit()
for i in range(n):
	pri(i)
print()
cur = n - 2
for i in range(n):
	pri(cur)
	cur -= 2
	cur %= n
print()
cur = n - 2
for i in range(n):
	pri(cur)
	cur -= 1
	cur %= n


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	a = ['{}'.format(i) for i in range(n)]
	b = ['{}'.format(i) for i in range(n)]
	c = ['{}'.format((int(a[i]) + int(b[i])) % n) for i in range(n)]
	print(' '.join(a))
	print(' '.join(b))
	print(' '.join(c))


import math
import random

def main(n):
	arr1 = [x for x in range(n)]
	if n % 2 == 0:
		print(-1)
		return
	arr2 = list(reversed(arr1))
	arr3 = []
	for i in range(len(arr1)):
		if arr2[i] >= arr1[i]:
			arr3.append(arr2[i] - arr1[i])
		else:
			arr3.append(n + arr2[i] - arr1[i])
	print(*arr1)
	print(*arr3)
	print(*arr2)
	return
n = int(input())
main(n)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect, insort
from time import perf_counter
from fractions import Fraction
import copy
from copy import deepcopy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
n = L()[0]
A = [i for i in range(n)]
B = [(i - 1) % n for i in range(n)]
if n % 2 == 0:
	print(-1)
else:
	print(*A)
	print(*B)
	C = [(A[i] + B[i]) % n for i in range(n)]
	print(*C)
endtime = time.time()


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	a = ' '.join((str(x) for x in range(n)))
	print(a)
	print(a)
	print(' '.join((str(x) for x in range(0, n, 2))), ' '.join((str(x) for x in range(1, n, 2))))


n = int(input())
print(-1) if n % 2 == 0 else print(*((i + i) % n if j == 2 else str(i) + '\n' if i == n - 1 else i for j in range(3) for i in range(n)))


from functools import reduce
import os
import sys
from collections import *
from decimal import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [str(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]

def Ceil(a, b):
	return a // b + int(a % b > 0)
albhabet = 'abcdefghijklmnopqrstuvwxyz'
mo = 1000000007
inf = 1e+18
div = 998244353
n = inn()
if n % 2 == 1:
	print(*[i for i in range(0, n)])
	print(*[i for i in range(0, n)])
	for i in range(n):
		print((i + i) % n, end=' ')
	print()
else:
	print(-1)


n = int(input())
if n % 2 == 0:
	print(-1)
	exit(0)
temp = [i for i in range(n)]
print(*temp)
temp2 = temp.copy()
last = temp2[-1]
del temp2[-1]
temp2.insert(0, last)
print(*temp2)
for i in range(n):
	print((temp[i] + temp2[i]) % n, end=' ')


import sys
import math
input = sys.stdin.readline
n = int(input())
if n % 2 == 0:
	print(-1)
	exit()
l = []
p1 = []
for i in range(n):
	l.append(i)
	p1.append(i)
p2 = [0] * n
i = 2
s = set()
ind = n - 1
while i < n:
	p2[ind] = i
	s.add(i)
	i += 2
	ind -= 1
i = 1
while ind > 0:
	p2[ind] = i
	s.add(i)
	i += 2
	ind -= 1
p3 = []
for i in range(n):
	p3.append((p1[i] + p2[i]) % n)
print(*p1)
print(*p2)
print(*p3)


import os
import sys
from io import BytesIO, IOBase
import math
mod = int(1000000000.0 + 7)

def main():
	n = int(input())
	if n % 2 == 0:
		print(-1)
		return
	print(*[x for x in range(0, n)])
	print(*[x for x in range(0, n)])
	print(*[(x + x) % n for x in range(0, n)])
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()


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	a = []
	b = []
	c = []
	for i in range(0, n):
		val = 0
		a.append(i)
		val += i
		if i == n - 1:
			b.append(0)
		else:
			b.append(i + 1)
			val += i + 1
		val = val % n
		c.append(val)
	print(*a)
	print(*b)
	print(*c)


def main():
	n = int(input())
	p1 = [i for i in range(n)]
	p2 = [i for i in range(n)]
	check = [False] * n
	p = [i for i in range(n)]
	ok = True
	for i in range(n):
		ind = (p1[i] + p2[i]) % n
		if not check[ind]:
			check[ind] = True
		else:
			ok = False
			break
		p[i] = ind
	if ok:
		print(*p1)
		print(*p2)
		print(*p)
	else:
		print(-1)
main()


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

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

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
a = []
for i in range(n):
	a.append(i)
if n % 2 == 0:
	print(-1)
else:
	print(*a)
	print(*a)
	c = []
	for i in range(n):
		c.append((i + i) % n)
	print(*c)


def solve(n):
	a = []
	b = []
	c = []
	for i in range(n):
		a.append(i)
	for i in range(1, n):
		b.append(i)
	b.append(0)
	for i in range(n):
		if a[i] + b[i] < n:
			c.append(a[i] + b[i])
		elif a[i] + b[i] == n:
			c.append(0)
		else:
			c.append(a[i] + b[i] - n)
	if len(c) != len(set(c)):
		print(-1)
	else:
		print(' '.join(map(str, a)))
		print(' '.join(map(str, b)))
		print(' '.join(map(str, c)))
n = int(input())
solve(n)


import random
t = 1
for _ in range(t):
	n = int(input())
	if n % 2 == 1:
		a = [i for i in range(n)]
		b = a
		c = [(a[i] + b[i]) % n for i in range(n)]
		print(*a)
		print(*b)
		print(*c)
	else:
		print(-1)


import math
import sys

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

def luckyperm():
	n = int(input())
	if not n % 2:
		print(-1)
		return
	other = []
	l = []
	for i in range(n):
		l.append(i)
		other.append((i + i) % n)
	print(*l)
	print(*l)
	print(*other)
luckyperm()


n = int(input())
if n & 1:
	(lis1, lis2) = [[x for x in range(n)] for i in range(2)]
	lis3 = [lis1[i] * 2 % n for i in range(n)]
	print(*lis1)
	print(*lis2)
	print(*lis3)
else:
	print(-1)


n = int(input())
if n % 2 == 0:
	print(-1)
	exit()
print(*range(0, n))
print(*range(0, n))
for x in range(n):
	print(2 * x % n, end=' ')
print()


n = int(input())
if n % 2 == 0:
	print(str(-1))
else:
	rang = range(0, n)
	for i in rang:
		print(i, end=' ')
	print()
	for i in rang:
		print(i, end=' ')
	print()
	for i in range(0, n):
		print(i * 2 % n, end=' ')


def compute(lista, i, j, n):
	return (lista[i] + lista[j]) % n
n = int(input())
if n % 2 == 0:
	print(-1)
elif n == 1:
	print(0)
	print(0)
	print(0)
else:
	lista = [*range(n)]
	a = [0] * n
	b = [0] * n
	i = 0
	j = i + 1
	for cont in range(n):
		a[cont] = (lista[i] + lista[j]) % n
		i = (i + 2) % n
		j = (i + 1) % n
	i = n - 1
	j = 0
	for cont in range(n):
		b[cont] = (lista[i] + lista[j]) % n
		i = (i + 2) % n
		j = (i + 1) % n
	c = [0] * n
	for i in range(n):
		c[i] = (a[i] + b[i]) % n
	print(*a)
	print(*b)
	print(*c)


n = int(input())
a = [i for i in range(n - 1, -1, -1)]
b = [i for i in range(n - 1, -1, -1)]
c = [(a[i] + b[i]) % n for i in range(n)]
G = sorted(c)
flag = 1
for i in range(n):
	if G[i] != i:
		flag = 0
if flag == 1:
	[print(a[i], end=' ') for i in range(n)]
	print()
	[print(b[i], end=' ') for i in range(n)]
	print()
	[print(c[i], end=' ') for i in range(n)]
else:
	print(-1)


n = int(input())
if n % 2:
	for i in range(n):
		print(i, end=' ')
	print()
	for j in range(n):
		print(j, end=' ')
	print()
	for k in range(n):
		print(2 * k % n, end=' ')
	print()
else:
	print(-1)
exit()


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	print(*range(n))
	print(*range(n))
	print(*map(lambda x: x * 2 % n, range(n)))


n = int(input())
if n % 2 == 0:
	print('-1')
	exit(0)
a = []
b = []
c = [0] * n
for i in range(n):
	a.append(i)
	b.append(i)
for i in range(n):
	c[i] = (a[i] + b[i]) % n
print(*a)
print(*b)
print(*c)


n = int(input())
C = [i for i in range(0, n)]
B = []
A = []
for num in C:
	if num < n - num:
		B.append((n - num) % n)
		A.append((num - (n - num) % n) % n)
	else:
		B.append((n - num) % n)
		A.append((n + num - (n - num) % n) % n)
if n % 2 == 0:
	print(-1)
else:
	for i in range(0, n):
		print(A[i], end=' ')
	print('\n')
	for i in range(0, n):
		print(B[i], end=' ')
	print('\n')
	for i in range(0, n):
		print(C[i], end=' ')


import math
import os
import sys
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import accumulate, combinations, permutations, combinations_with_replacement, product
from collections import *
M = 10 ** 9 + 7
import heapq
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
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')

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchcount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] == key:
			return mid
		if arr[mid] <= key:
			left = mid + 1
		else:
			right = mid - 1
	return -1

def ternarysearch(arr, n, key):
	(l, r) = (0, n - 1)
	while l <= r:
		mid = (-l + r) // 3 + l
		mid2 = mid + (-l + r) // 3
		if arr[mid] == key:
			return mid
		if arr[mid2] == key:
			return mid2
		if arr[mid] > key:
			r = mid - 1
		elif arr[mid2] < key:
			l = mid2 + 1
		else:
			l = mid + 1
			r = mid2 - 1
	return -1

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, M):
	if b == 1:
		return a % M
	if b == 0:
		return 1
	if b % 2 == 0:
		ans = binpowmodulus(a, b // 2, M)
		return ans * ans % M
	else:
		ans = binpowmodulus(a, (b - 1) // 2, M)
		return ans * a % M * ans % M

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynum(x, l, r, a):
	if x >= l and x <= r:
		a.append(x)
	if x > r:
		a.append(x)
		return a
	if x < 10000000000.0:
		luckynum(x * 10 + 4, l, r, a)
		luckynum(x * 10 + 7, l, r, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def findOR(nums, N):
	prefix_sum = 0
	result = 0
	for i in range(N):
		result |= nums[i]
		prefix_sum += nums[i]
		result |= prefix_sum
	return result

def OR(a, n):
	ans = a[0]
	for i in range(1, n):
		ans |= a[i]
	return ans

def toString(List):
	return ''.join(List)

def permute(a, l, r, p):
	if l == r:
		p.append(toString(a))
	else:
		for i in range(l, r + 1):
			(a[l], a[i]) = (a[i], a[l])
			permute(a, l + 1, r, p)
			(a[l], a[i]) = (a[i], a[l])

def squareRoot(number, precision):
	start = 0
	(end, ans) = (number, 1)
	while start <= end:
		mid = int((start + end) / 2)
		if mid * mid == number:
			ans = mid
			break
		if mid * mid < number:
			start = mid + 1
		else:
			end = mid - 1
	increment = 0.1
	for i in range(0, precision):
		while ans * ans <= number:
			ans += increment
		ans = ans - increment
		increment = increment / 10
	return ans

def countRectangles(l, w):
	squareSide = math.gcd(l, w)
	return int(l * w / (squareSide * squareSide))

def count_same_digit(L, R):
	tmp = 0
	ans = 0
	n = int(math.log10(R) + 1)
	for i in range(0, n):
		tmp = tmp * 10 + 1
		for j in range(1, 10):
			if L <= tmp * j and tmp * j <= R:
				ans += 1
	return ans

def findCrossOver(arr, low, high, x):
	if arr[high] <= x:
		return high
	if arr[low] > x:
		return low
	mid = (low + high) // 2
	if arr[mid] <= x and arr[mid + 1] > x:
		return mid
	if arr[mid] < x:
		return findCrossOver(arr, mid + 1, high, x)
	return findCrossOver(arr, low, mid - 1, x)

def Kclosest(arr, x, k, n, ans):
	l = findCrossOver(arr, 0, n - 1, x)
	r = l + 1
	count = 0
	if arr[l] == x:
		l -= 1
	while l >= 0 and r < n and (count < k):
		if x - arr[l] < arr[r] - x:
			ans.append(arr[l])
			l -= 1
		else:
			ans.append(arr[r])
			r += 1
		count += 1
	while count < k and l >= 0:
		ans.append(arr[l])
		l -= 1
		count += 1
	while count < k and r < n:
		ans.append(arr[r])
		r += 1
		count += 1
	return ans

def calcSum(arr, n, k):
	l = []
	sum = 0
	for i in range(k):
		sum += arr[i]
	l.append(sum)
	for i in range(k, n):
		sum = sum - arr[i - k] + arr[i]
		l.append(sum)
	return l
import math
MAX = 10 ** 5
prefix = [0] * (MAX + 1)

def buildPrefix():
	prime = [1] * (MAX + 1)
	p = 2
	while p * p <= MAX:
		if prime[p] == 1:
			i = p * 2
			while i <= MAX:
				prime[i] = 0
				i += p
		p += 1
	for p in range(2, MAX + 1):
		prefix[p] = prefix[p - 1]
		if prime[p] == 1:
			prefix[p] += 1

def query(L, R):
	return prefix[R] - prefix[L - 1]

def maxSubArraySum(a, size):
	max_so_far = a[0]
	curr_max = a[0]
	for i in range(1, size):
		curr_max = max(a[i], curr_max + a[i])
		max_so_far = max(max_so_far, curr_max)
	return max_so_far

def solve(n, k):
	if n == 1 and k == 1:
		return 0
	mid = 2 ** (n - 1) // 2
	if k <= mid:
		return solve(n - 1, k)
	else:
		return solve(n - 1, k - mid) == 0

def solvr(s, p):
	if len(s) == 0:
		print(p, end=' ')
		return
	op1 = p
	op2 = p + s[0]
	s = s[1:]
	solvr(s, op1)
	solvr(s, op2)
	return

def paranthesis(n, m, ans, l):
	if n == 0 and m == 0:
		print(ans)
		return
	if n != 0:
		op1 = ans + '('
		paranthesis(n - 1, m, op1, l)
	if m > n:
		op2 = ans + ')'
		paranthesis(n, m - 1, op2, l)

def lcs(s, r):
	rr = len(r)
	ss = len(s)
	l = [[0] * (rr + 1) for i in range(ss + 1)]
	for i in range(1, ss + 1):
		for j in range(1, rr + 1):
			if s[i - 1] == r[j - 1]:
				l[i][j] = l[i - 1][j - 1] + 1
			else:
				l[i][j] = max(l[i - 1][j], l[i][j - 1])
	return l[ss][rr]

class Graph(object):

	def __init__(self, vertices):
		self.graph = defaultdict(list)
		self.V = vertices

	def addEdge(self, u, v):
		self.graph[u].append(v)
		self.graph[v].append(u)

	def connectedComponents(self):
		unvisited = set(range(self.V))
		queue = deque()
		count = 0
		while len(unvisited) > 0:
			count += 1
			v = next(iter(unvisited))
			unvisited.remove(v)
			queue.append(v)
			while len(queue) > 0:
				v = queue.popleft()
				for w in self.graph[v]:
					if w in unvisited:
						unvisited.remove(w)
						queue.append(w)
		return count

def maxSumIS(arr, n):
	msis = arr.copy()
	for i in range(1, n):
		for j in range(i):
			if arr[i] > arr[j] and msis[i] < msis[j] + arr[i]:
				msis[i] = msis[j] + arr[i]
	c = max(msis)
	return c

def main():
	n = inpu()
	l = []
	m = []
	for i in range(n - 1, -1, -1):
		if i < n // 2:
			l.append(n + i)
		else:
			m.append(i)
	m += l
	(a, b, c) = ([], [], [])
	for i in range(n):
		a.append(i)
	for i in range(n):
		b.append(m[i] - a[i])
	for i in range(n):
		c.append(m[i] % n)
	if len(set(a)) != n or len(set(b)) != n or len(set(c)) != n:
		print(-1)
	else:
		print(*a)
		print(*b)
		print(*c)
main()


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	print(' '.join(map(str, list(range(0, n)))))
	il = [0]
	for i in range(1, n):
		if i <= n // 2:
			il.append(n - 2 * i)
		else:
			il.append(n - 1 - 2 * (i - n // 2 - 1))
	print(' '.join(map(str, il)))
	print(' '.join(map(str, [(i + il[i]) % n for i in range(0, n)])))


n = int(input())
if n % 2 == 0:
	print(-1)
	exit()
a = list(range(n))
b = a
c = []
for i in range(n):
	c.append((a[i] + b[i]) % n)
a = map(str, a)
b = map(str, b)
c = map(str, c)
print(' '.join(a))
print(' '.join(b))
print(' '.join(c))


def main():
	n = int(input())
	if n % 2 == 0:
		print(-1)
		return
	a = list(range(n))
	c = [(e + e) % n for e in a]
	print(*a)
	print(*a)
	print(*c)
	return
main()


from bisect import *
import math
from collections import *
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7
n = int(input())
if n % 2 == 0:
	print(-1)
	exit()
a = [i for i in range(n)]
b = [i for i in range(n)]
c = []
for i in range(n):
	temp = a[i] + b[i]
	c.append(temp % n)
print(*a)
print(*b)
print(*c)


n = int(input())
if n % 2 == 1:
	print(*range(n))
	print(*range(n))
	print(*[(x + y) % n for (x, y) in zip(range(n), range(n))])
else:
	print(-1)


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

def binomial_coefficient(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0
n = int(input())
if n % 2 == 0:
	print(-1)
else:
	p1 = []
	p2 = []
	p3 = []
	for i in range(n):
		p1.append(i)
		p2.append((i + 1) % n)
		p3.append((i + (i + 1)) % n)
	print(' '.join([str(e) for e in p1]))
	print(' '.join([str(e) for e in p2]))
	print(' '.join([str(e) for e in p3]))


n = int(input())
if n & 1:
	t = ' '.join(map(str, range(n)))
	print(t)
	print(t[2:] + ' 0')
	print(' '.join(map(str, list(range(1, n, 2)) + list(range(0, n, 2)))))
else:
	print(-1)


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	for x in range(n):
		print(x)
	for x in range(n):
		print(x)
	for x in range(n):
		print((x + x) % n)


n = int(input())
if n % 2 == 1:
	a = [i for i in range(n)]
	a = map(str, a)
	c = [2 * i % n for i in range(n)]
	c = map(str, c)
	a = ' '.join(a)
	print(a)
	print(a)
	print(' '.join(c))
else:
	print(-1)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

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

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

def in_ints():
	return map(int, input().split())
n = in_int()
a = []
b = []
c = []
ss = set()
ans = True
for i in range(n):
	a.append(i)
	b.append(i)
	if (i + i) % n in ss:
		ans = False
		break
	ss.add((i + i) % n)
	c.append((i + i) % n)
if ans:
	for xx in a:
		print(xx, end=' ')
	print()
	for xx in b:
		print(xx, end=' ')
	print()
	for xx in c:
		print(xx, end=' ')
	print()
else:
	print(-1)


n = int(input())
if n & 1:
	print(*list(range(n)))
	print(*list(range(n)))
	print(*[2 * i % n for i in range(n)])
else:
	print(-1)


n = int(input())
a = []
b = []
c = []
for i in range(n):
	a.append(i)
	b.append(i)
used = [0] * n
can = True
for i in range(n):
	c.append((a[i] + b[i]) % n)
	if used[c[i]]:
		can = False
		break
	used[c[i]] = 1
if can == False:
	print('-1')
	exit()
print(' '.join(map(str, a)))
print(' '.join(map(str, b)))
print(' '.join(map(str, c)))


from collections import Counter
n = int(input())
s = []
a = []
s.append(n - 1)
for i in range(n - 1):
	s.append(i)
for j in range(n):
	a.append(j)
ll = []
for k in range(n):
	ll.append((s[k] + a[k]) % n)
count = Counter(ll)
if max(count.values()) > 1:
	print(-1)
else:
	print(*s)
	print(*a)
	print(*ll)


from sys import stdin, stdout
input = stdin.readline

def write(n, sep='\n'):
	stdout.write(str(n))
	stdout.write(sep)

def gil():
	return list(map(int, input().split()))
n = int(input())
if n % 2 == 0:
	print(-1)
else:
	p = list(range(n))
	print(*p)
	print(*p)
	for i in range(n):
		print(i * 2 % n, end=' ')
	print()


import sys
lines = sys.stdin.readlines()
N = int(lines[0].strip())
if N % 2 == 0:
	print(-1)
else:
	res = ''
	for i in range(N):
		res += str(i) + ' '
	print(res[:-1])
	print(res[:-1])
	l = [i * 2 % N for i in range(N)]
	l = list(map(str, l))
	print(' '.join(l))


a = int(input())
t = ''
tt = ''
ttt = ''
if a % 2 != 0:
	for x in range(0, a):
		t = t + (str(x) + ' ')
	for x in range(0, a):
		tt = tt + (str(x) + ' ')
	for x in range(0, a):
		ttt = ttt + (str(2 * x % a) + ' ')
else:
	print(-1)
print(t)
print(tt)
print(ttt)


from math import ceil, sqrt, gcd, log, floor
from collections import deque

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

def si():
	return input()

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

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

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
n = ii()
if n % 2 == 0:
	print('-1')
else:
	a = []
	b = []
	c = []
	for i in range(n):
		a.append(i)
		b.append(i)
		c.append((i + i) % n)
	print(*a)
	print(*b)
	print(*c)


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	lista = list(range(n))
	saida = list(map(lambda x: 2 * x % n, lista))
	print(' '.join(map(str, lista)))
	print(' '.join(map(str, lista)))
	print(' '.join(map(str, saida)))


from itertools import zip_longest
n = int(input())
a = list(range(n))
b = list(range(n))
c = []
for (i, j) in zip_longest(a, b):
	c.append((i + j) % n)
if len(c) != len(set(c)):
	print(-1)
else:
	print(*a)
	print(*b)
	print(*c)


n = int(input())
if n % 2 != 0:
	lis = [i for i in range(n)]
	ans = [(i + i) % n for i in range(n)]
	print(*lis)
	print(*lis)
	print(*ans)
else:
	print(-1)


import sys
import string
import math
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

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

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def main():
	n = iline()
	if n % 2 == 0:
		print(-1)
		return
	lst = list(range(n))
	left = lst[:n // 2 + 1]
	right = lst[n // 2 + 1:]
	ans = []
	for (a, b) in zip(left, right):
		ans.append(a)
		ans.append(b)
	ans.append(left[-1])
	print(js(ans))
	print(js(ans))
	print(js(range(n)))
main()


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	l = []
	for i in range(n):
		l.append(i)
	print(*l)
	print(*l)
	for i in range(n):
		l[i] = 2 * l[i] % n
	print(*l)


n = int(input())
if n % 2 == 0:
	print(-1)
else:
	a = list(range(n))
	print(*a)
	print(*a)
	print(*a[::2] + a[1::2])


n = int(input())
if n % 2 == 0:
	print(-1)
elif n == 1:
	print(0)
	print(0)
	print(0)
else:
	p = [0] * n
	q = [0] * n
	w = [0] * n
	t = int(n / 2)
	for i in range(0, n):
		p[i] = i
		if i < t:
			q[i] = n - 2 - 2 * i
		else:
			q[i] = 4 * t - 2 * i
		if i <= n - 2:
			w[i] = n - 2 - i
		else:
			w[i] = n - 1
	for i in range(0, n):
		if i != n - 1:
			print(p[i], end=' ')
		else:
			print(p[i])
	for i in range(0, n):
		if i != n - 1:
			print(q[i], end=' ')
		else:
			print(q[i])
	for i in range(0, n):
		if i != n - 1:
			print(w[i], end=' ')
		else:
			print(w[i])


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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 value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
c = [i for i in range(n)]
if not n % 2:
	print(-1)
	exit()
print(*c)
print(*c)
print(*[2 * i % n for i in c])