import java.io.*;
import java.math.BigInteger;
public class Main
{
{
new Main().run();
}
{
st.nextToken();
return (double)st.nval;
}
{
st.nextToken();
}
{
st.nextToken();
return (int)st.nval;
}
{
st.nextToken();
return (long)st.nval;
}
{
solve();
out.flush();
}
{
int n = nextInt();
if (n % 4 == 2 || n % 4 == 3){
out.print(-1);
return;
}
if (n == 1){
out.println(1);
out.println(2);
out.println(3);
return;
}
if (n == 4){
out.println("4 2 3 1");
out.println("8 9 7 5");
out.println("12 11 10 6");
return;
}
if (n == 5){
out.println("7 3 4 2 1");
out.println("8 11 9 10 5");
out.println("15 14 13 12 6");
return;
}
if (n == 8){
out.println("8 6 4 2 7 1 5 3");
out.println("16 17 18 19 13 10 9 12");
out.println("24 23 22 21 20 11 14 15");
return;
}
if (n % 4 == 0){
int[] mas1 = new int[n];
int[] mas2 = new int[n];
int[] mas3 = new int[n];
int k = n / 4;
for (int i = 0; i < 2 * k; i++){
mas3[i] = 12 * k - i;
mas2[i] = 8 * k + i;
mas1[i] = mas3[i] - mas2[i];
}
for (int i=1; i<k; i++){
mas3[i + 2 * k - 1] = 8 * k - i - 1;
mas2[i + 2 * k - 1] = 4 * k + i;
mas1[i + 2 * k - 1] = mas3[i + 2 * k - 1] - mas2[i + 2 * k - 1];
}
for (int i=0; i<k - 2; i++){
mas3[3 * k - 1 + i] = 7 * k - 1 - i;
mas2[3 * k - 1 + i] = 5 * k + 2 + i;
mas1[3 * k - 1 + i] = mas3[3 * k - 1 + i] - mas2[3 * k - 1 + i];
}
mas3[n - 3] = 10 * k;
mas3[n - 2] = 8 * k - 1;
mas3[n - 1] = 5 * k + 1;
mas2[n - 3] = 6 * k + 1;
mas2[n - 2] = 6 * k;
mas2[n - 1] = 5 * k;
mas1[n - 3] = 4 * k - 1;
mas1[n - 2] = 2 * k - 1;
mas1[n - 1] = 1;
for (int i=0; i<n; i++){
out.print(mas1[i] + " ");
}
out.println();
for (int i=0; i<n; i++){
out.print(mas2[i] + " ");
}
out.println();
for (int i=0; i<n; i++){
out.print(mas3[i] + " ");
}
return;
}
if (n % 4 == 1){
int[] mas1 = new int[n];
int[] mas2 = new int[n];
int[] mas3 = new int[n];
int k = n / 4;
for (int i = 0; i < 2 * k; i++){
mas3[i] = 12 * k + 3 - i;
mas2[i] = 8 * k + 3 + i;
mas1[i] = mas3[i] - mas2[i];
}
for (int i=1; i<=k; i++){
mas3[i + 2 * k - 1] = 8 * k - i + 2;
mas2[i + 2 * k - 1] = 4 * k + i + 1;
mas1[i + 2 * k - 1] = mas3[i + 2 * k - 1] - mas2[i + 2 * k - 1];
}
for (int i=1; i<k - 1; i++){
mas3[3 * k + i - 1] = 7 * k + 2 - i;
mas2[3 * k + i - 1] = 5 * k + 3 + i;
mas1[3 * k + i - 1] = mas3[3 * k - 1 + i] - mas2[3 * k - 1 + i];
}
mas3[n - 3] = 10 * k + 3;
mas3[n - 2] = 8 * k + 2;
mas3[n - 1] = 5 * k + 3;
mas2[n - 3] = 6 * k + 2;
mas2[n - 2] = 6 * k + 3;
mas2[n - 1] = 5 * k + 2;
mas1[n - 3] = 4 * k + 1;
mas1[n - 2] = 2 * k - 1;
mas1[n - 1] = 1;
for (int i=0; i<n; i++){
out.print(mas1[i] + " ");
}
out.println();
for (int i=0; i<n; i++){
out.print(mas2[i] + " ");
}
out.println();
for (int i=0; i<n; i++){
out.print(mas3[i] + " ");
}
return;
}
}
}