Problem: 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.

Solution (in JAVA):

Solution:
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;

public class S {
	
	static private long ans;
	static private long count1;
	static private long count2;
	static private long tmp;
	
	private static int[][] arr;
	private static int n;
	
	private static long[] larr;
	
	static class Reader {
		
		static BufferedReader reader;
		static StringTokenizer tokenizer;
		
		static void init(InputStream input) {
			reader = new BufferedReader(new InputStreamReader(input));
			tokenizer = new StringTokenizer("");
		}
		
		static String next() throws IOException {
			while(!tokenizer.hasMoreTokens()) {
				tokenizer = new StringTokenizer(reader.readLine());
			}
			return tokenizer.nextToken();
		}
		
		static int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		
		static long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		
	}

	
	static int[] merge(int[] a, int[] b) {
		int m = a.length;
		int n = b.length;
		int [] c = new int[n+m];
		
		int j=0, k=0;
		while(j+k<m+n) {
			if(j>=m) {
				c[j+k] = b[k];
				k++;
			}
			else if(k>=n) {
				c[j+k] = a[j];
				j++;
			}
			else {
				if(a[j]<b[k]) {
					c[j+k] = a[j];
					j++;
				}
				else if(a[j]==b[k]) {
					if(a[j]<b[k]) {
						c[j+k] = a[j];
						j++;
					}
					else {
						c[j+k] = b[k];
						k++;
					}
				}
				else {
					c[j+k] = b[k];
					k++;
				}
			}
		}
		return c;
	}
	
	static int[] Msort(int[] unsorted){
		int l = unsorted.length;
		
		if(l<=1) {
			return unsorted;
		}
		
		else {
			int[] Msorted = new int[l];
			int[] m1 = new int[l/2];
			int[] m2 = new int[l-(l/2)];
			
			for(int i=0; i<l; i++) {
				if(i<l/2) {
					m1[i] = unsorted[i];
				}
				else {
					m2[i-(l/2)] = unsorted[i];
				}
			}
			
			Msorted = merge(Msort(m1), Msort(m2));		
			
			return Msorted;
		}
		
	}
	
	static long[] merge(long[] a, long[] b) {
		int m = a.length;
		int n = b.length;
		long [] c = new long[n+m];
		
		int j=0, k=0;
		while(j+k<m+n) {
			if(j>=m) {
				c[j+k] = b[k];
				k++;
			}
			else if(k>=n) {
				c[j+k] = a[j];
				j++;
			}
			else {
				if(a[j]<b[k]) {
					c[j+k] = a[j];
					j++;
				}
				else if(a[j]==b[k]) {
					if(a[j]<b[k]) {
						c[j+k] = a[j];
						j++;
					}
					else {
						c[j+k] = b[k];
						k++;
					}
				}
				else {
					c[j+k] = b[k];
					k++;
				}
			}
		}
		return c;
	}
	
	static long[] Msort(long[] unsorted){
		int l = unsorted.length;
		
		if(l<=1) {
			return unsorted;
		}
		
		else {
			long[] Msorted = new long[l];
			long[] m1 = new long[l/2];
			long[] m2 = new long[l-(l/2)];
			
			for(int i=0; i<l; i++) {
				if(i<l/2) {
					m1[i] = unsorted[i];
				}
				else {
					m2[i-(l/2)] = unsorted[i];
				}
			}
			
			Msorted = merge(Msort(m1), Msort(m2));		
			
			return Msorted;
		}
		
	}

	
	static int[][] merge_x(int[][] a, int[][] b) {
		int m = a.length;
		int n = b.length;
		int [][] c = new int[n+m][2];
		
		int j=0, k=0;
		while(j+k<m+n) {
			if(j>=m) {
				c[j+k][0] = b[k][0];
				c[j+k][1] = b[k][1];
				k++;
			}
			else if(k>=n) {
				c[j+k][0] = a[j][0];
				c[j+k][1] = a[j][1];
				j++;
			}
			else {
				if(a[j][0]<b[k][0]) {
					c[j+k][0] = a[j][0];
					c[j+k][1] = a[j][1];
					j++;
				}
				else if(a[j][0]==b[k][0]) {
					if(a[j][1]<b[k][1]) {
						c[j+k][0] = a[j][0];
						c[j+k][1] = a[j][1];
						j++;
					}
					else {
						c[j+k][0] = b[k][0];
						c[j+k][1] = b[k][1];
						k++;
					}
				}
				else {
					c[j+k][0] = b[k][0];
					c[j+k][1] = b[k][1];
					k++;
				}
			}
		}
		return c;
	}
	
	static int[][] Msort_x(int[][] unsorted){
		int l = unsorted.length;
		
		if(l<=1) {
			return unsorted;
		}
		
		else {
			int[][] Msorted = new int[l][2];
			int[][] m1 = new int[l/2][2];
			int[][] m2 = new int[l-(l/2)][2];
			
			for(int i=0; i<l; i++) {
				if(i<l/2) {
					m1[i][0] = unsorted[i][0];
					m1[i][1] = unsorted[i][1];
				}
				else {
					m2[i-(l/2)][0] = unsorted[i][0];
					m2[i-(l/2)][1] = unsorted[i][1];
				}
			}
			
			Msorted = merge_x(Msort_x(m1), Msort_x(m2));
			
			return Msorted;
		}
		
	}
	
	static int[][] merge_y(int[][] a, int[][] b) {
		int m = a.length;
		int n = b.length;
		int [][] c = new int[n+m][2];
		
		int j=0, k=0;
		while(j+k<m+n) {
			if(j>=m) {
				c[j+k][0] = b[k][0];
				c[j+k][1] = b[k][1];
				k++;
			}
			else if(k>=n) {
				c[j+k][0] = a[j][0];
				c[j+k][1] = a[j][1];
				j++;
			}
			else {
				if(a[j][1]<b[k][1]) {
					c[j+k][0] = a[j][0];
					c[j+k][1] = a[j][1];
					j++;
				}
				else if(a[j][1]==b[k][1]) {
					if(a[j][0]<b[k][0]) {
						c[j+k][0] = a[j][0];
						c[j+k][1] = a[j][1];
						j++;
					}
					else {
						c[j+k][0] = b[k][0];
						c[j+k][1] = b[k][1];
						k++;
					}
				}
				else {
					c[j+k][0] = b[k][0];
					c[j+k][1] = b[k][1];
					k++;
				}
			}
		}
		return c;
	}
	
	static int[][] Msort_y(int[][] unsorted){
		int l = unsorted.length;
		
		if(l<=1) {
			return unsorted;
		}
		
		else {
			int[][] Msorted = new int[l][2];
			int[][] m1 = new int[l/2][2];
			int[][] m2 = new int[l-(l/2)][2];
			
			for(int i=0; i<l; i++) {
				if(i<l/2) {
					m1[i][0] = unsorted[i][0];
					m1[i][1] = unsorted[i][1];
				}
				else {
					m2[i-(l/2)][0] = unsorted[i][0];
					m2[i-(l/2)][1] = unsorted[i][1];
				}
			}
			
			Msorted = merge_y(Msort_y(m1), Msort_y(m2));
			
			return Msorted;
		}
		
	}
	
	static int[][] merge_3(int[][] a, int[][] b) {
		int m = a.length;
		int n = b.length;
		int [][] c = new int[n+m][3];
		
		int j=0, k=0;
		while(j+k<m+n) {
			if(j>=m) {
				c[j+k][0] = b[k][0];
				c[j+k][1] = b[k][1];
				c[j+k][2] = b[k][2];
				k++;
			}
			else if(k>=n) {
				c[j+k][0] = a[j][0];
				c[j+k][1] = a[j][1];
				c[j+k][2] = a[j][2];
				j++;
			}
			else {
				if(a[j][0]<b[k][0]) {
					c[j+k][0] = a[j][0];
					c[j+k][1] = a[j][1];
					c[j+k][2] = a[j][2];
					j++;
				}
				else if(a[j][0]==b[k][0] && a[j][1]<b[k][1]) {
					c[j+k][0] = a[j][0];
					c[j+k][1] = a[j][1];
					c[j+k][2] = a[j][2];
					j++;
				}
				else {
					c[j+k][0] = b[k][0];
					c[j+k][1] = b[k][1];
					c[j+k][2] = b[k][2];
					k++;
				}
			}
		}
		return c;
	}
	
	static int[][] Msort_3(int[][] unsorted){
		int l = unsorted.length;
		
		if(l<=1) {
			return unsorted;
		}
		
		else {
			int[][] Msorted = new int[l][3];
			int[][] m1 = new int[l/2][3];
			int[][] m2 = new int[l-(l/2)][3];
			
			for(int i=0; i<l; i++) {
				if(i<l/2) {
					m1[i][0] = unsorted[i][0];
					m1[i][1] = unsorted[i][1];
					m1[i][2] = unsorted[i][2];
				}
				else {
					m2[i-(l/2)][0] = unsorted[i][0];
					m2[i-(l/2)][1] = unsorted[i][1];
					m2[i-(l/2)][2] = unsorted[i][2];
				}
			}
			
			Msorted = merge_3(Msort_3(m1), Msort_3(m2));
			
			return Msorted;
		}
		
	}

	
	public static void print2dArray(int [][] arr) {
		for(int i=0; i<arr.length; i++) {
			System.out.println(arr[i][0]+" "+arr[i][1]+" ");
		}
	}
	
	public static void solve_x() {
		
		int i=1;
		count1=1;
		
		while(i<n) {
			
			if(arr[i][0]==arr[i-1][0]) {
				count1++;
			}
			else {
				ans+=(count1*(count1-1))/2;
				count1=1;
			}
			
			i++;
			
		}

		
		ans+=(count1*(count1-1))/2;
		
	}
	
	public static void solve_y() {

		int i=1;
		count1=1;
		count2=1;
		
		while(i<n) {

			//System.out.println(count1);
				
			boolean b1 = arr[i][1]==arr[i-1][1]; 
			boolean b2 = arr[i][0]==arr[i-1][0];
						
			if(b1&&b2) {
				count1++;
				count2++;
			}
			else if(b1) {
				count1++;
				ans-=(count2*(count2-1))/2;
				
				//System.out.println("ans: "+ans+" count1: "+count1);
				count2=1;
			}
			else {
				ans+=(count1*(count1-1))/2;
				//System.out.println("ans: "+ans);
				ans-=(count2*(count2-1))/2;
				//System.out.println("ans: "+ans);
				count1=1;
				count2=1;
			}
			
			i++;
			
		}
		ans-=(count2*(count2-1))/2;
		ans+=(count1*(count1-1))/2;
		
	}
	
    static boolean binarySearch(int arr[], int x, int y) 
    { 
        int l = 0, r = arr.length - 1; 
        while (l <= r) { 
            int m = l + (r - l) / 2; 
  
            // If x greater, ignore left half 
            if (arr[m] < x) 
                l = m + 1; 
  
            // If x is smaller, ignore right half 
            else if(arr[m] > y)
                r = m - 1; 
            
            else {
            	return true;
            }
        } 
  
        // if we reach here, then element was 
        // not present 
        return false; 
    } 
    
    static int gcd(int a, int b) 
    { 
        if (a == 0) 
            return b; 
        return gcd(b % a, a); 
    } 
  
    // Function to find gcd of array of 
    // numbers 
    static int findGCD(int arr[]) 
    { 
        int result = 0; 
        for (int element: arr){ 
            result = gcd(result, element); 
  
            if(result == 1) 
            { 
               return 1; 
            } 
        } 
  
        return result; 
    }
	
	public static void main(String[] args) throws IOException {
		
		tmp = 0;
		count1 = 0;
		count2 = 0;
		
		ans = 0;
		
		Reader.init(System.in);
		
		OutputStream out = new BufferedOutputStream(System.out);
		
		int n = Reader.nextInt();
		
		if((n&1)==0) {
			System.out.println(-1);
			return;
		}
				
		for(int i=0; i<n; i++) {
			out.write((i+" ").getBytes());
		}
		out.flush();
		System.out.println();
		for(int i=0; i<n; i++) {
			out.write((i+" ").getBytes());
		}
		out.flush();
		System.out.println();
		for(int i=0; i<n; i++) {
			int j = (i*2)%n;
			out.write((j+" ").getBytes());
		}
		out.flush();


	//	System.out.println(ans);
		
	

	}

}

// 3 4 6 5 15 1 1 9 12 13