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 $\forall i(1 \leq i \leq n), a_{i} + b_{i} \equiv c_{i} \operatorname{mod} n$. The sign a_{i} denotes the i-th element of permutation a. The modular equality described above denotes that the remainders after dividing a_{i} + b_{i} by n and dividing c_{i} 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 ≤ 10^5).


-----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:  $1 + 1 \equiv 2 \equiv 2 \operatorname{mod} 5$;  $4 + 0 \equiv 4 \equiv 4 \operatorname{mod} 5$;  $3 + 2 \equiv 0 \equiv 0 \operatorname{mod} 5$;  $2 + 4 \equiv 6 \equiv 1 \operatorname{mod} 5$;  $0 + 3 \equiv 3 \equiv 3 \operatorname{mod} 5$. 

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

Difficulty: competition

Starter code:

Solutions:
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')
else:
    a = list(range(n))
    print(' '.join(map(str, a)))
    print(' '.join(map(str, a)))
    print(' '.join([str((x[0] + x[1]) % n) for x in zip(a, a)]))


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:
    print(*list(range(n)))
    print(*list(range(n)))
    print(*((i + i) % n for i in range(n)))


n = int(input())

if n % 2 == 0:
    print(-1)
else:
    print(" ".join(map(str, range(n))))
    print(" ".join(map(str, range(n))))
    print(" ".join(map(str, [2*x % n for x in range(n)])))

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)
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)))

#!/usr/bin/env python3
n = int(input())
if n % 2 == 0:
    print(-1)
else:
    print(*list(range(n)))
    print(*list(range(n)))
    print(*list(map(lambda x, y: (x + y) % n, list(range(n)), list(range(n)))))


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)

n = int(input())

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


n = int(input())



if n % 2 == 0:

    print(-1)

else:

    print(*list(range(n)))

    print(*list(range(n)))

    print(*((i + i) % n for i in range(n)))



n = int(input())
if n % 2 == 0:
    print(-1)
else:
    print(*list(range(n)))
    print(*list(range(n)))
    a = list()
    for i in range(n):
        a.append((i + i) % n)
    print(*a)



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

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:
    print(-1)
    return
print(*list(range(n)))
print(*list(range(n)))
res = []
for i in range(n):
    res += [(2*i) % n]
print(*res)


n = int(input())

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


n = int(input())

if n % 2 == 0:
    print(-1)
else:
    lista = list(range(n))
    saida = list([(2*x)%n for x in lista])
    print(' '.join(map(str, lista)))
    print(' '.join(map(str, lista)))
    print(' '.join(map(str, saida)))


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])









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=' ')
    
            


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)))


def __starting_point():
    n = int(input())

    solve(n)
__starting_point()

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)

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

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

n = int(input())
if n % 2 == 1:
    for i in range(n):
        print(i, end=" ")
    print()
    for i in range(n):
        print((i + 1)%n, end=" ")
    print()
    for i in range(n):
        print((i + (i + 1)%n)%n, end=" ")
else:
    print(-1)