#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = (1 << 29) - 1;
const double eqs = 1e-8;
const int N = 1000003;
int a[100003];
int b[100003];
int tag[100003];
int main() {
  int n, i;
  scanf("%d", &n);
  if (n & 1) {
    for (i = 0; i < n; i++) printf("%d%c", i, i == (n - 1) ? '\n' : ' ');
    int top = 0;
    for (i = n - 2; i >= 0; i -= 2) {
      a[top] = i;
      b[top] = (i + top) % n;
      if (tag[b[top]]) return -1;
      tag[b[top]] = 1;
      top++;
    }
    for (i = n - 1; i >= 0; i -= 2) {
      a[top] = i;
      b[top] = (i + top) % n;
      if (tag[b[top]]) return -1;
      tag[b[top]] = 1;
      top++;
    }
    for (i = 0; i < n; i++) printf("%d%c", a[i], i == (n - 1) ? '\n' : ' ');
    for (i = 0; i < n; i++) printf("%d%c", b[i], i == (n - 1) ? '\n' : ' ');
  } else
    printf("-1\n");
  return 0;
}
